home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / lisp / wgdb-42.lha / wgdb-4.2 / gdb / c-exp.tab.c < prev    next >
C/C++ Source or Header  |  1992-09-11  |  75KB  |  2,494 lines

  1.  
  2. /*  A Bison parser, made from ./c-exp.y  */
  3.  
  4. #define    INT    258
  5. #define    CHAR    259
  6. #define    UINT    260
  7. #define    FLOAT    261
  8. #define    STRING    262
  9. #define    NAME    263
  10. #define    TYPENAME    264
  11. #define    NAME_OR_INT    265
  12. #define    NAME_OR_UINT    266
  13. #define    STRUCT    267
  14. #define    UNION    268
  15. #define    ENUM    269
  16. #define    SIZEOF    270
  17. #define    UNSIGNED    271
  18. #define    COLONCOLON    272
  19. #define    ERROR    273
  20. #define    SIGNED    274
  21. #define    LONG    275
  22. #define    SHORT    276
  23. #define    INT_KEYWORD    277
  24. #define    LAST    278
  25. #define    REGNAME    279
  26. #define    VARIABLE    280
  27. #define    ASSIGN_MODIFY    281
  28. #define    THIS    282
  29. #define    ABOVE_COMMA    283
  30. #define    OR    284
  31. #define    AND    285
  32. #define    EQUAL    286
  33. #define    NOTEQUAL    287
  34. #define    LEQ    288
  35. #define    GEQ    289
  36. #define    LSH    290
  37. #define    RSH    291
  38. #define    UNARY    292
  39. #define    INCREMENT    293
  40. #define    DECREMENT    294
  41. #define    ARROW    295
  42. #define    BLOCKNAME    296
  43.  
  44. #line 29 "./c-exp.y"
  45.  
  46.  
  47. #include <stdio.h>
  48. #include <string.h>
  49. #include "defs.h"
  50. #include "param.h"
  51. #include "symtab.h"
  52. #include "frame.h"
  53. #include "expression.h"
  54. #include "parser-defs.h"
  55. #include "value.h"
  56. #include "language.h"
  57.  
  58. /* These MUST be included in any grammar file!!!! 
  59.    Please choose unique names! */
  60. #define    yyparse    c_parse
  61. #define    yylex    c_lex
  62. #define    yyerror    c_error
  63. #define    yylval    c_lval
  64. #define    yychar    c_char
  65. #define    yydebug    c_debug
  66. #define    yypact    c_pact    
  67. #define    yyr1    c_r1            
  68. #define    yyr2    c_r2            
  69. #define    yydef    c_def        
  70. #define    yychk    c_chk        
  71. #define    yypgo    c_pgo        
  72. #define    yyact    c_act        
  73. #define    yyexca    c_exca
  74. #define yyerrflag c_errflag
  75. #define yynerrs    c_nerrs
  76. #define    yyps    c_ps
  77. #define    yypv    c_pv
  78. #define    yys    c_s
  79. #define    yystate    c_state
  80. #define    yytmp    c_tmp
  81. #define    yyv    c_v
  82. #define    yyval    c_val
  83. #define    yylloc    c_lloc
  84.  
  85. /* Forward decls */
  86. void yyerror ();
  87. static int parse_number ();
  88. int yyparse ();
  89.  
  90. /* #define    YYDEBUG    1 */
  91.  
  92.  
  93. #line 82 "./c-exp.y"
  94. typedef union
  95.   {
  96.     LONGEST lval;
  97.     unsigned LONGEST ulval;
  98.     double dval;
  99.     struct symbol *sym;
  100.     struct type *tval;
  101.     struct stoken sval;
  102.     struct ttype tsym;
  103.     struct symtoken ssym;
  104.     int voidval;
  105.     struct block *bval;
  106.     enum exp_opcode opcode;
  107.     struct internalvar *ivar;
  108.  
  109.     struct type **tvec;
  110.     int *ivec;
  111.   } YYSTYPE;
  112.  
  113. #ifndef YYLTYPE
  114. typedef
  115.   struct yyltype
  116.     {
  117.       int timestamp;
  118.       int first_line;
  119.       int first_column;
  120.       int last_line;
  121.       int last_column;
  122.       char *text;
  123.    }
  124.   yyltype;
  125.  
  126. #define YYLTYPE yyltype
  127. #endif
  128.  
  129. #include <stdio.h>
  130.  
  131. #ifndef __STDC__
  132. #define const
  133. #endif
  134.  
  135.  
  136.  
  137. #define    YYFINAL        199
  138. #define    YYFLAG        -32768
  139. #define    YYNTBASE    66
  140.  
  141. #define YYTRANSLATE(x) ((unsigned)(x) <= 296 ? yytranslate[x] : 85)
  142.  
  143. static const char yytranslate[] = {     0,
  144.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  145.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  146.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  147.      2,     2,    59,     2,     2,     2,    50,    36,     2,    57,
  148.     62,    48,    46,    28,    47,    55,    49,     2,     2,     2,
  149.      2,     2,     2,     2,     2,     2,     2,    65,     2,    39,
  150.     30,    40,    31,    45,     2,     2,     2,     2,     2,     2,
  151.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  152.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  153.     56,     2,    61,    35,     2,     2,     2,     2,     2,     2,
  154.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  155.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  156.      2,     2,    63,    34,    64,    60,     2,     2,     2,     2,
  157.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  158.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  159.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  160.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  161.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  162.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  163.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  164.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  165.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  166.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  167.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  168.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  169.      2,     2,     2,     2,     2,     1,     2,     3,     4,     5,
  170.      6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
  171.     16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
  172.     26,    27,    29,    32,    33,    37,    38,    41,    42,    43,
  173.     44,    51,    52,    53,    54,    58
  174. };
  175.  
  176. static const short yyprhs[] = {     0,
  177.      0,     2,     4,     6,     8,    12,    15,    18,    21,    24,
  178.     27,    30,    33,    36,    39,    42,    46,    51,    55,    60,
  179.     65,    66,    72,    73,    75,    79,    84,    89,    93,    97,
  180.    101,   105,   109,   113,   117,   121,   125,   129,   133,   137,
  181.    141,   145,   149,   153,   157,   161,   165,   169,   175,   179,
  182.    183,   185,   187,   189,   191,   193,   195,   197,   199,   201,
  183.    203,   208,   210,   212,   214,   218,   222,   226,   231,   234,
  184.    236,   238,   241,   243,   246,   248,   251,   253,   257,   260,
  185.    262,   265,   267,   270,   274,   277,   279,   283,   290,   299,
  186.    309,   311,   313,   315,   317,   320,   324,   327,   331,   335,
  187.    340,   343,   347,   350,   353,   356,   359,   361,   364,   366,
  188.    368,   370,   372,   374,   376,   380,   382,   384,   386,   388,
  189.    390,   392
  190. };
  191.  
  192. static const short yyrhs[] = {    68,
  193.      0,    67,     0,    79,     0,    69,     0,    68,    28,    69,
  194.      0,    48,    69,     0,    36,    69,     0,    47,    69,     0,
  195.     59,    69,     0,    60,    69,     0,    52,    69,     0,    53,
  196.     69,     0,    69,    52,     0,    69,    53,     0,    15,    69,
  197.      0,    69,    54,    83,     0,    69,    54,    48,    69,     0,
  198.     69,    55,    83,     0,    69,    55,    48,    69,     0,    69,
  199.     56,    68,    61,     0,     0,    69,    57,    70,    71,    62,
  200.      0,     0,    69,     0,    71,    28,    69,     0,    63,    79,
  201.     64,    69,     0,    57,    79,    62,    69,     0,    57,    68,
  202.     62,     0,    69,    45,    69,     0,    69,    48,    69,     0,
  203.     69,    49,    69,     0,    69,    50,    69,     0,    69,    46,
  204.     69,     0,    69,    47,    69,     0,    69,    43,    69,     0,
  205.     69,    44,    69,     0,    69,    37,    69,     0,    69,    38,
  206.     69,     0,    69,    41,    69,     0,    69,    42,    69,     0,
  207.     69,    39,    69,     0,    69,    40,    69,     0,    69,    36,
  208.     69,     0,    69,    35,    69,     0,    69,    34,    69,     0,
  209.     69,    33,    69,     0,    69,    32,    69,     0,    69,    31,
  210.     69,    65,    69,     0,    69,    30,    69,     0,    69,    26,
  211.     69,     0,     3,     0,    10,     0,     5,     0,    11,     0,
  212.      4,     0,     6,     0,    73,     0,    23,     0,    24,     0,
  213.     25,     0,    15,    57,    79,    62,     0,     7,     0,    27,
  214.      0,    58,     0,    72,    17,    83,     0,    72,    17,    83,
  215.      0,    80,    17,    83,     0,    80,    17,    60,    83,     0,
  216.     17,    83,     0,    84,     0,    80,     0,    80,    75,     0,
  217.     48,     0,    48,    75,     0,    36,     0,    36,    75,     0,
  218.     76,     0,    57,    75,    62,     0,    76,    77,     0,    77,
  219.      0,    76,    78,     0,    78,     0,    56,    61,     0,    56,
  220.      3,    61,     0,    57,    62,     0,    74,     0,    80,    17,
  221.     48,     0,    79,    57,    80,    17,    48,    62,     0,    79,
  222.     57,    80,    17,    48,    62,    57,    62,     0,    79,    57,
  223.     80,    17,    48,    62,    57,    82,    62,     0,     9,     0,
  224.     22,     0,    20,     0,    21,     0,    20,    22,     0,    16,
  225.     20,    22,     0,    20,    20,     0,    20,    20,    22,     0,
  226.     16,    20,    20,     0,    16,    20,    20,    22,     0,    21,
  227.     22,     0,    16,    21,    22,     0,    12,    83,     0,    13,
  228.     83,     0,    14,    83,     0,    16,    81,     0,    16,     0,
  229.     19,    81,     0,    19,     0,     9,     0,    22,     0,    20,
  230.      0,    21,     0,    79,     0,    82,    28,    79,     0,     8,
  231.      0,    58,     0,     9,     0,    10,     0,    11,     0,     8,
  232.      0,    58,     0
  233. };
  234.  
  235. #if YYDEBUG != 0
  236. static const short yyrline[] = { 0,
  237.    176,   177,   180,   187,   188,   193,   196,   199,   203,   207,
  238.    211,   215,   219,   223,   227,   231,   237,   241,   247,   251,
  239.    255,   259,   265,   268,   272,   276,   282,   288,   294,   298,
  240.    302,   306,   310,   314,   318,   322,   326,   330,   334,   338,
  241.    342,   346,   350,   354,   358,   362,   366,   370,   374,   378,
  242.    384,   394,   407,   419,   432,   439,   446,   449,   455,   461,
  243.    467,   474,   481,   488,   506,   516,   529,   542,   560,   606,
  244.    700,   701,   736,   738,   740,   742,   744,   747,   749,   754,
  245.    760,   762,   766,   768,   772,   776,   777,   779,   781,   784,
  246.    791,   793,   795,   797,   799,   801,   803,   805,   807,   809,
  247.    811,   813,   815,   818,   821,   824,   826,   828,   830,   834,
  248.    835,   841,   847,   856,   861,   868,   869,   870,   871,   872,
  249.    875,   876
  250. };
  251.  
  252. static const char * const yytname[] = {   "$",
  253. "error","$illegal.","INT","CHAR","UINT","FLOAT","STRING","NAME","TYPENAME","NAME_OR_INT",
  254. "NAME_OR_UINT","STRUCT","UNION","ENUM","SIZEOF","UNSIGNED","COLONCOLON","ERROR","SIGNED","LONG",
  255. "SHORT","INT_KEYWORD","LAST","REGNAME","VARIABLE","ASSIGN_MODIFY","THIS","','","ABOVE_COMMA","'='",
  256. "'?'","OR","AND","'|'","'^'","'&'","EQUAL","NOTEQUAL","'<'","'>'",
  257. "LEQ","GEQ","LSH","RSH","'@'","'+'","'-'","'*'","'/'","'%'",
  258. "UNARY","INCREMENT","DECREMENT","ARROW","'.'","'['","'('","BLOCKNAME","'!'","'~'",
  259. "']'","')'","'{'","'}'","':'","start","type_exp","exp1","exp","@1",
  260. "arglist","block","variable","ptype","abs_decl","direct_abs_decl","array_mod","func_mod","type","typebase",
  261. "typename","nonempty_typelist","name","name_not_typename",""
  262. };
  263. #endif
  264.  
  265. static const short yyr1[] = {     0,
  266.     66,    66,    67,    68,    68,    69,    69,    69,    69,    69,
  267.     69,    69,    69,    69,    69,    69,    69,    69,    69,    69,
  268.     70,    69,    71,    71,    71,    69,    69,    69,    69,    69,
  269.     69,    69,    69,    69,    69,    69,    69,    69,    69,    69,
  270.     69,    69,    69,    69,    69,    69,    69,    69,    69,    69,
  271.     69,    69,    69,    69,    69,    69,    69,    69,    69,    69,
  272.     69,    69,    69,    72,    72,    73,    73,    73,    73,    73,
  273.     74,    74,    75,    75,    75,    75,    75,    76,    76,    76,
  274.     76,    76,    77,    77,    78,    79,    79,    79,    79,    79,
  275.     80,    80,    80,    80,    80,    80,    80,    80,    80,    80,
  276.     80,    80,    80,    80,    80,    80,    80,    80,    80,    81,
  277.     81,    81,    81,    82,    82,    83,    83,    83,    83,    83,
  278.     84,    84
  279. };
  280.  
  281. static const short yyr2[] = {     0,
  282.      1,     1,     1,     1,     3,     2,     2,     2,     2,     2,
  283.      2,     2,     2,     2,     2,     3,     4,     3,     4,     4,
  284.      0,     5,     0,     1,     3,     4,     4,     3,     3,     3,
  285.      3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
  286.      3,     3,     3,     3,     3,     3,     3,     5,     3,     3,
  287.      1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
  288.      4,     1,     1,     1,     3,     3,     3,     4,     2,     1,
  289.      1,     2,     1,     2,     1,     2,     1,     3,     2,     1,
  290.      2,     1,     2,     3,     2,     1,     3,     6,     8,     9,
  291.      1,     1,     1,     1,     2,     3,     2,     3,     3,     4,
  292.      2,     3,     2,     2,     2,     2,     1,     2,     1,     1,
  293.      1,     1,     1,     1,     3,     1,     1,     1,     1,     1,
  294.      1,     1
  295. };
  296.  
  297. static const short yydefact[] = {     0,
  298.     51,    55,    53,    56,    62,   121,    91,    52,    54,     0,
  299.      0,     0,     0,   107,     0,   109,    93,    94,    92,    58,
  300.     59,    60,    63,     0,     0,     0,     0,     0,     0,   122,
  301.      0,     0,     0,     2,     1,     4,     0,    57,    86,     3,
  302.     71,    70,   116,   118,   119,   120,   117,   103,   104,   105,
  303.      0,    15,     0,   110,   112,   113,   111,   106,    69,   112,
  304.    113,   108,    97,    95,   101,     7,     8,     6,    11,    12,
  305.      0,     0,     9,    10,     0,    71,     0,     0,     0,     0,
  306.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  307.      0,     0,     0,     0,     0,     0,     0,     0,     0,    13,
  308.     14,     0,     0,     0,    21,     0,     0,     0,    75,    73,
  309.      0,     0,    72,    77,    80,    82,     0,     0,    99,    96,
  310.    102,    98,    28,     0,     0,     0,     5,    50,    49,     0,
  311.     47,    46,    45,    44,    43,    37,    38,    41,    42,    39,
  312.     40,    35,    36,    29,    33,    34,    30,    31,    32,     0,
  313.     16,     0,    18,     0,    23,    66,     0,    87,     0,    67,
  314.     76,    74,     0,    83,    85,     0,     0,    79,    81,    61,
  315.    100,    27,    26,     0,    17,    19,    20,    24,     0,     0,
  316.     68,    84,    78,    48,     0,    22,     0,    25,    88,     0,
  317.     89,   114,     0,     0,    90,   115,     0,     0,     0
  318. };
  319.  
  320. static const short yydefgoto[] = {   197,
  321.     34,    71,    36,   155,   179,    37,    38,    39,   113,   114,
  322.    115,   116,    40,    53,    58,   193,   160,    42
  323. };
  324.  
  325. static const short yypact[] = {   112,
  326. -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   168,
  327.    168,   168,   192,     1,   168,   133,    71,    -5,-32768,-32768,
  328. -32768,-32768,-32768,   112,   112,   112,   112,   112,   112,    11,
  329.    112,   112,   273,-32768,     6,   335,    22,-32768,-32768,   -11,
  330.    266,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  331.    112,   132,    72,-32768,    81,    83,-32768,-32768,-32768,-32768,
  332. -32768,-32768,    87,-32768,-32768,   132,   132,   132,   132,   132,
  333.    -19,   -31,   132,   132,   -39,   271,   112,   112,   112,   112,
  334.    112,   112,   112,   112,   112,   112,   112,   112,   112,   112,
  335.    112,   112,   112,   112,   112,   112,   112,   112,   112,-32768,
  336. -32768,    52,   172,   112,-32768,   168,   273,    44,   243,   243,
  337.     27,   185,-32768,    88,-32768,-32768,   -30,    48,    92,-32768,
  338. -32768,-32768,-32768,   112,   112,    46,   335,   335,   335,   299,
  339.    387,   411,   434,   456,   477,   496,   496,   511,   511,   511,
  340.    511,   524,   524,   536,   546,   546,   132,   132,   132,   112,
  341. -32768,   112,-32768,    69,   112,   124,   129,-32768,   168,-32768,
  342. -32768,-32768,    86,-32768,-32768,    89,    94,-32768,-32768,   253,
  343. -32768,   132,   132,   112,   132,   132,-32768,   335,   -17,   101,
  344. -32768,-32768,-32768,   362,   112,-32768,    95,   335,    93,    28,
  345. -32768,   -11,    36,   273,-32768,   -11,   161,   166,-32768
  346. };
  347.  
  348. static const short yypgoto[] = {-32768,
  349. -32768,     7,   -12,-32768,-32768,-32768,-32768,-32768,   -74,-32768,
  350.     54,    60,   -27,     0,   175,-32768,    -7,-32768
  351. };
  352.  
  353.  
  354. #define    YYLAST        603
  355.  
  356.  
  357. static const short yytable[] = {    41,
  358.     52,    72,    48,    49,    50,    75,    35,    59,    77,    54,
  359.    185,    66,    67,    68,    69,    70,    65,   107,    73,    74,
  360.     55,    56,    57,   117,   125,   107,   107,   -64,    41,   163,
  361.    124,   170,    76,    77,   161,   162,     7,   166,   106,    10,
  362.     11,    12,   123,    14,   186,   107,    16,    17,    18,    19,
  363.     41,    43,    44,    45,    46,    43,    44,    45,    46,    43,
  364.     44,    45,    46,   194,   127,   128,   129,   130,   131,   132,
  365.    133,   134,   135,   136,   137,   138,   139,   140,   141,   142,
  366.    143,   144,   145,   146,   147,   148,   149,   164,   118,   191,
  367.     63,   158,    64,   158,   151,   153,    77,   195,   156,   150,
  368.    119,    47,   120,   159,   121,    47,   157,   159,   122,    47,
  369.    154,   172,   173,   171,     1,     2,     3,     4,     5,     6,
  370.      7,     8,     9,    10,    11,    12,    13,    14,    15,   177,
  371.     16,    17,    18,    19,    20,    21,    22,   175,    23,   176,
  372.    -65,    54,   178,   111,   167,   180,   182,    24,   187,   190,
  373.    183,   181,    60,    61,    57,   165,   189,   172,    25,    26,
  374.    198,   184,   192,    27,    28,   199,   196,   168,    29,    30,
  375.     31,    32,   188,   169,    33,    43,    44,    45,    46,    43,
  376.     44,    45,    46,   100,   101,   102,   103,   104,   105,    76,
  377.     62,     0,     0,    76,     1,     2,     3,     4,     5,     6,
  378.      7,     8,     9,    10,    11,    12,    13,    14,    15,     0,
  379.     16,    17,    18,    19,    20,    21,    22,     0,    23,   152,
  380.    109,     0,     0,     0,     0,    47,     0,    24,     0,    47,
  381.      0,     0,   110,     0,     0,     0,     0,     0,    25,    26,
  382.    111,   112,     0,    27,    28,     0,   165,     0,    51,    30,
  383.     31,    32,     0,     0,    33,     1,     2,     3,     4,     5,
  384.      6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
  385.      0,    16,    17,    18,    19,    20,    21,    22,   109,    23,
  386.      0,     7,   108,     0,    10,    11,    12,   126,    14,     0,
  387.    110,    16,    17,    18,    19,     0,     0,     0,   111,   112,
  388.      0,   109,     0,     0,    27,    28,   109,     0,     0,    29,
  389.     30,    31,    32,   110,     0,    33,     0,     0,   110,     0,
  390.      0,   111,   112,     0,    78,     0,   111,   112,    79,    80,
  391.     81,    82,    83,    84,    85,    86,    87,    88,    89,    90,
  392.     91,    92,    93,    94,    95,    96,    97,    98,    99,     0,
  393.    100,   101,   102,   103,   104,   105,     0,     0,     0,     0,
  394.     78,     0,     0,   174,    79,    80,    81,    82,    83,    84,
  395.     85,    86,    87,    88,    89,    90,    91,    92,    93,    94,
  396.     95,    96,    97,    98,    99,     0,   100,   101,   102,   103,
  397.    104,   105,    80,    81,    82,    83,    84,    85,    86,    87,
  398.     88,    89,    90,    91,    92,    93,    94,    95,    96,    97,
  399.     98,    99,     0,   100,   101,   102,   103,   104,   105,    82,
  400.     83,    84,    85,    86,    87,    88,    89,    90,    91,    92,
  401.     93,    94,    95,    96,    97,    98,    99,     0,   100,   101,
  402.    102,   103,   104,   105,    83,    84,    85,    86,    87,    88,
  403.     89,    90,    91,    92,    93,    94,    95,    96,    97,    98,
  404.     99,     0,   100,   101,   102,   103,   104,   105,    84,    85,
  405.     86,    87,    88,    89,    90,    91,    92,    93,    94,    95,
  406.     96,    97,    98,    99,     0,   100,   101,   102,   103,   104,
  407.    105,    85,    86,    87,    88,    89,    90,    91,    92,    93,
  408.     94,    95,    96,    97,    98,    99,     0,   100,   101,   102,
  409.    103,   104,   105,    86,    87,    88,    89,    90,    91,    92,
  410.     93,    94,    95,    96,    97,    98,    99,     0,   100,   101,
  411.    102,   103,   104,   105,    88,    89,    90,    91,    92,    93,
  412.     94,    95,    96,    97,    98,    99,     0,   100,   101,   102,
  413.    103,   104,   105,    92,    93,    94,    95,    96,    97,    98,
  414.     99,     0,   100,   101,   102,   103,   104,   105,    94,    95,
  415.     96,    97,    98,    99,     0,   100,   101,   102,   103,   104,
  416.    105,    95,    96,    97,    98,    99,     0,   100,   101,   102,
  417.    103,   104,   105,    97,    98,    99,     0,   100,   101,   102,
  418.    103,   104,   105
  419. };
  420.  
  421. static const short yycheck[] = {     0,
  422.     13,    29,    10,    11,    12,    33,     0,    15,    28,     9,
  423.     28,    24,    25,    26,    27,    28,    22,    57,    31,    32,
  424.     20,    21,    22,    51,    64,    57,    57,    17,    29,     3,
  425.     62,    62,    33,    28,   109,   110,     9,   112,    17,    12,
  426.     13,    14,    62,    16,    62,    57,    19,    20,    21,    22,
  427.     51,     8,     9,    10,    11,     8,     9,    10,    11,     8,
  428.      9,    10,    11,    28,    77,    78,    79,    80,    81,    82,
  429.     83,    84,    85,    86,    87,    88,    89,    90,    91,    92,
  430.     93,    94,    95,    96,    97,    98,    99,    61,    17,    62,
  431.     20,    48,    22,    48,   102,   103,    28,    62,   106,    48,
  432.     20,    58,    22,    60,    22,    58,   107,    60,    22,    58,
  433.    104,   124,   125,    22,     3,     4,     5,     6,     7,     8,
  434.      9,    10,    11,    12,    13,    14,    15,    16,    17,    61,
  435.     19,    20,    21,    22,    23,    24,    25,   150,    27,   152,
  436.     17,     9,   155,    56,    57,    17,    61,    36,    48,    57,
  437.     62,   159,    20,    21,    22,    62,    62,   170,    47,    48,
  438.      0,   174,   190,    52,    53,     0,   194,   114,    57,    58,
  439.     59,    60,   185,   114,    63,     8,     9,    10,    11,     8,
  440.      9,    10,    11,    52,    53,    54,    55,    56,    57,   190,
  441.     16,    -1,    -1,   194,     3,     4,     5,     6,     7,     8,
  442.      9,    10,    11,    12,    13,    14,    15,    16,    17,    -1,
  443.     19,    20,    21,    22,    23,    24,    25,    -1,    27,    48,
  444.     36,    -1,    -1,    -1,    -1,    58,    -1,    36,    -1,    58,
  445.     -1,    -1,    48,    -1,    -1,    -1,    -1,    -1,    47,    48,
  446.     56,    57,    -1,    52,    53,    -1,    62,    -1,    57,    58,
  447.     59,    60,    -1,    -1,    63,     3,     4,     5,     6,     7,
  448.      8,     9,    10,    11,    12,    13,    14,    15,    16,    17,
  449.     -1,    19,    20,    21,    22,    23,    24,    25,    36,    27,
  450.     -1,     9,    17,    -1,    12,    13,    14,    17,    16,    -1,
  451.     48,    19,    20,    21,    22,    -1,    -1,    -1,    56,    57,
  452.     -1,    36,    -1,    -1,    52,    53,    36,    -1,    -1,    57,
  453.     58,    59,    60,    48,    -1,    63,    -1,    -1,    48,    -1,
  454.     -1,    56,    57,    -1,    26,    -1,    56,    57,    30,    31,
  455.     32,    33,    34,    35,    36,    37,    38,    39,    40,    41,
  456.     42,    43,    44,    45,    46,    47,    48,    49,    50,    -1,
  457.     52,    53,    54,    55,    56,    57,    -1,    -1,    -1,    -1,
  458.     26,    -1,    -1,    65,    30,    31,    32,    33,    34,    35,
  459.     36,    37,    38,    39,    40,    41,    42,    43,    44,    45,
  460.     46,    47,    48,    49,    50,    -1,    52,    53,    54,    55,
  461.     56,    57,    31,    32,    33,    34,    35,    36,    37,    38,
  462.     39,    40,    41,    42,    43,    44,    45,    46,    47,    48,
  463.     49,    50,    -1,    52,    53,    54,    55,    56,    57,    33,
  464.     34,    35,    36,    37,    38,    39,    40,    41,    42,    43,
  465.     44,    45,    46,    47,    48,    49,    50,    -1,    52,    53,
  466.     54,    55,    56,    57,    34,    35,    36,    37,    38,    39,
  467.     40,    41,    42,    43,    44,    45,    46,    47,    48,    49,
  468.     50,    -1,    52,    53,    54,    55,    56,    57,    35,    36,
  469.     37,    38,    39,    40,    41,    42,    43,    44,    45,    46,
  470.     47,    48,    49,    50,    -1,    52,    53,    54,    55,    56,
  471.     57,    36,    37,    38,    39,    40,    41,    42,    43,    44,
  472.     45,    46,    47,    48,    49,    50,    -1,    52,    53,    54,
  473.     55,    56,    57,    37,    38,    39,    40,    41,    42,    43,
  474.     44,    45,    46,    47,    48,    49,    50,    -1,    52,    53,
  475.     54,    55,    56,    57,    39,    40,    41,    42,    43,    44,
  476.     45,    46,    47,    48,    49,    50,    -1,    52,    53,    54,
  477.     55,    56,    57,    43,    44,    45,    46,    47,    48,    49,
  478.     50,    -1,    52,    53,    54,    55,    56,    57,    45,    46,
  479.     47,    48,    49,    50,    -1,    52,    53,    54,    55,    56,
  480.     57,    46,    47,    48,    49,    50,    -1,    52,    53,    54,
  481.     55,    56,    57,    48,    49,    50,    -1,    52,    53,    54,
  482.     55,    56,    57
  483. };
  484. /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
  485. #line 3 "/usr/latest/lib/bison.simple"
  486.  
  487. /* Skeleton output parser for bison,
  488.    Copyright (C) 1984, 1989, 1990 Bob Corbett and Richard Stallman
  489.  
  490.    This program is free software; you can redistribute it and/or modify
  491.    it under the terms of the GNU General Public License as published by
  492.    the Free Software Foundation; either version 1, or (at your option)
  493.    any later version.
  494.  
  495.    This program is distributed in the hope that it will be useful,
  496.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  497.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  498.    GNU General Public License for more details.
  499.  
  500.    You should have received a copy of the GNU General Public License
  501.    along with this program; if not, write to the Free Software
  502.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  503.  
  504.  
  505. #ifndef alloca
  506. #ifdef __GNUC__
  507. #define alloca __builtin_alloca
  508. #else /* Not GNU C.  */
  509. #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__)
  510. #include <alloca.h>
  511. #else /* Not sparc */
  512. #ifdef MSDOS
  513. #include <malloc.h>
  514. #endif /* MSDOS */
  515. #endif /* Not sparc.  */
  516. #endif /* Not GNU C.  */
  517. #endif /* alloca not defined.  */
  518.  
  519. /* This is the parser code that is written into each bison parser
  520.   when the %semantic_parser declaration is not specified in the grammar.
  521.   It was written by Richard Stallman by simplifying the hairy parser
  522.   used when %semantic_parser is specified.  */
  523.  
  524. /* Note: there must be only one dollar sign in this file.
  525.    It is replaced by the list of actions, each action
  526.    as one case of the switch.  */
  527.  
  528. #define yyerrok        (yyerrstatus = 0)
  529. #define yyclearin    (yychar = YYEMPTY)
  530. #define YYEMPTY        -2
  531. #define YYEOF        0
  532. #define YYACCEPT    return(0)
  533. #define YYABORT     return(1)
  534. #define YYERROR        goto yyerrlab1
  535. /* Like YYERROR except do call yyerror.
  536.    This remains here temporarily to ease the
  537.    transition to the new meaning of YYERROR, for GCC.
  538.    Once GCC version 2 has supplanted version 1, this can go.  */
  539. #define YYFAIL        goto yyerrlab
  540. #define YYRECOVERING()  (!!yyerrstatus)
  541. #define YYBACKUP(token, value) \
  542. do                                \
  543.   if (yychar == YYEMPTY && yylen == 1)                \
  544.     { yychar = (token), yylval = (value);            \
  545.       yychar1 = YYTRANSLATE (yychar);                \
  546.       YYPOPSTACK;                        \
  547.       goto yybackup;                        \
  548.     }                                \
  549.   else                                \
  550.     { yyerror ("syntax error: cannot back up"); YYERROR; }    \
  551. while (0)
  552.  
  553. #define YYTERROR    1
  554. #define YYERRCODE    256
  555.  
  556. #ifndef YYPURE
  557. #define YYLEX        yylex()
  558. #endif
  559.  
  560. #ifdef YYPURE
  561. #ifdef YYLSP_NEEDED
  562. #define YYLEX        yylex(&yylval, &yylloc)
  563. #else
  564. #define YYLEX        yylex(&yylval)
  565. #endif
  566. #endif
  567.  
  568. /* If nonreentrant, generate the variables here */
  569.  
  570. #ifndef YYPURE
  571.  
  572. int    yychar;            /*  the lookahead symbol        */
  573. YYSTYPE    yylval;            /*  the semantic value of the        */
  574.                 /*  lookahead symbol            */
  575.  
  576. #ifdef YYLSP_NEEDED
  577. YYLTYPE yylloc;            /*  location data for the lookahead    */
  578.                 /*  symbol                */
  579. #endif
  580.  
  581. int yynerrs;            /*  number of parse errors so far       */
  582. #endif  /* not YYPURE */
  583.  
  584. #if YYDEBUG != 0
  585. int yydebug;            /*  nonzero means print parse trace    */
  586. /* Since this is uninitialized, it does not stop multiple parsers
  587.    from coexisting.  */
  588. #endif
  589.  
  590. /*  YYINITDEPTH indicates the initial size of the parser's stacks    */
  591.  
  592. #ifndef    YYINITDEPTH
  593. #define YYINITDEPTH 200
  594. #endif
  595.  
  596. /*  YYMAXDEPTH is the maximum size the stacks can grow to
  597.     (effective only if the built-in stack extension method is used).  */
  598.  
  599. #if YYMAXDEPTH == 0
  600. #undef YYMAXDEPTH
  601. #endif
  602.  
  603. #ifndef YYMAXDEPTH
  604. #define YYMAXDEPTH 10000
  605. #endif
  606.  
  607. #ifndef __cplusplus
  608.  
  609. /* This is the most reliable way to avoid incompatibilities
  610.    in available built-in functions on various systems.  */
  611. static void
  612. __yy_bcopy (from, to, count)
  613.      char *from;
  614.      char *to;
  615.      int count;
  616. {
  617.   register char *f = from;
  618.   register char *t = to;
  619.   register int i = count;
  620.  
  621.   while (i-- > 0)
  622.     *t++ = *f++;
  623. }
  624.  
  625. #else /* __cplusplus */
  626.  
  627. /* This is the most reliable way to avoid incompatibilities
  628.    in available built-in functions on various systems.  */
  629. static void
  630. __yy_bcopy (char *from, char *to, int count)
  631. {
  632.   register char *f = from;
  633.   register char *t = to;
  634.   register int i = count;
  635.  
  636.   while (i-- > 0)
  637.     *t++ = *f++;
  638. }
  639.  
  640. #endif
  641.  
  642. #line 160 "/usr/latest/lib/bison.simple"
  643. int
  644. yyparse()
  645. {
  646.   register int yystate;
  647.   register int yyn;
  648.   register short *yyssp;
  649.   register YYSTYPE *yyvsp;
  650.   int yyerrstatus;    /*  number of tokens to shift before error messages enabled */
  651.   int yychar1;        /*  lookahead token as an internal (translated) token number */
  652.  
  653.   short    yyssa[YYINITDEPTH];    /*  the state stack            */
  654.   YYSTYPE yyvsa[YYINITDEPTH];    /*  the semantic value stack        */
  655.  
  656.   short *yyss = yyssa;        /*  refer to the stacks thru separate pointers */
  657.   YYSTYPE *yyvs = yyvsa;    /*  to allow yyoverflow to reallocate them elsewhere */
  658.  
  659. #ifdef YYLSP_NEEDED
  660.   YYLTYPE *yyls = yylsa;
  661.   YYLTYPE *yylsp;
  662.   YYLTYPE yylsa[YYINITDEPTH];    /*  the location stack            */
  663.  
  664. #define YYPOPSTACK   (yyvsp--, yysp--, yylsp--)
  665. #else
  666. #define YYPOPSTACK   (yyvsp--, yysp--)
  667. #endif
  668.  
  669.   int yystacksize = YYINITDEPTH;
  670.  
  671. #ifdef YYPURE
  672.   int yychar;
  673.   YYSTYPE yylval;
  674.   int yynerrs;
  675. #ifdef YYLSP_NEEDED
  676.   YYLTYPE yylloc;
  677. #endif
  678. #endif
  679.  
  680.   YYSTYPE yyval;        /*  the variable used to return        */
  681.                 /*  semantic values from the action    */
  682.                 /*  routines                */
  683.  
  684.   int yylen;
  685.  
  686. #if YYDEBUG != 0
  687.   if (yydebug)
  688.     fprintf(stderr, "Starting parse\n");
  689. #endif
  690.  
  691.   yystate = 0;
  692.   yyerrstatus = 0;
  693.   yynerrs = 0;
  694.   yychar = YYEMPTY;        /* Cause a token to be read.  */
  695.  
  696.   /* Initialize stack pointers.
  697.      Waste one element of value and location stack
  698.      so that they stay on the same level as the state stack.  */
  699.  
  700.   yyssp = yyss - 1;
  701.   yyvsp = yyvs;
  702. #ifdef YYLSP_NEEDED
  703.   yylsp = yyls;
  704. #endif
  705.  
  706. /* Push a new state, which is found in  yystate  .  */
  707. /* In all cases, when you get here, the value and location stacks
  708.    have just been pushed. so pushing a state here evens the stacks.  */
  709. yynewstate:
  710.  
  711.   *++yyssp = yystate;
  712.  
  713.   if (yyssp >= yyss + yystacksize - 1)
  714.     {
  715.       /* Give user a chance to reallocate the stack */
  716.       /* Use copies of these so that the &'s don't force the real ones into memory. */
  717.       YYSTYPE *yyvs1 = yyvs;
  718.       short *yyss1 = yyss;
  719. #ifdef YYLSP_NEEDED
  720.       YYLTYPE *yyls1 = yyls;
  721. #endif
  722.  
  723.       /* Get the current used size of the three stacks, in elements.  */
  724.       int size = yyssp - yyss + 1;
  725.  
  726. #ifdef yyoverflow
  727.       /* Each stack pointer address is followed by the size of
  728.      the data in use in that stack, in bytes.  */
  729.       yyoverflow("parser stack overflow",
  730.          &yyss1, size * sizeof (*yyssp),
  731.          &yyvs1, size * sizeof (*yyvsp),
  732. #ifdef YYLSP_NEEDED
  733.          &yyls1, size * sizeof (*yylsp),
  734. #endif
  735.          &yystacksize);
  736.  
  737.       yyss = yyss1; yyvs = yyvs1;
  738. #ifdef YYLSP_NEEDED
  739.       yyls = yyls1;
  740. #endif
  741. #else /* no yyoverflow */
  742.       /* Extend the stack our own way.  */
  743.       if (yystacksize >= YYMAXDEPTH)
  744.     {
  745.       yyerror("parser stack overflow");
  746.       return 2;
  747.     }
  748.       yystacksize *= 2;
  749.       if (yystacksize > YYMAXDEPTH)
  750.     yystacksize = YYMAXDEPTH;
  751.       yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
  752.       __yy_bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
  753.       yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
  754.       __yy_bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
  755. #ifdef YYLSP_NEEDED
  756.       yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
  757.       __yy_bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
  758. #endif
  759. #endif /* no yyoverflow */
  760.  
  761.       yyssp = yyss + size - 1;
  762.       yyvsp = yyvs + size - 1;
  763. #ifdef YYLSP_NEEDED
  764.       yylsp = yyls + size - 1;
  765. #endif
  766.  
  767. #if YYDEBUG != 0
  768.       if (yydebug)
  769.     fprintf(stderr, "Stack size increased to %d\n", yystacksize);
  770. #endif
  771.  
  772.       if (yyssp >= yyss + yystacksize - 1)
  773.     YYABORT;
  774.     }
  775.  
  776. #if YYDEBUG != 0
  777.   if (yydebug)
  778.     fprintf(stderr, "Entering state %d\n", yystate);
  779. #endif
  780.  
  781.  yybackup:
  782.  
  783. /* Do appropriate processing given the current state.  */
  784. /* Read a lookahead token if we need one and don't already have one.  */
  785. /* yyresume: */
  786.  
  787.   /* First try to decide what to do without reference to lookahead token.  */
  788.  
  789.   yyn = yypact[yystate];
  790.   if (yyn == YYFLAG)
  791.     goto yydefault;
  792.  
  793.   /* Not known => get a lookahead token if don't already have one.  */
  794.  
  795.   /* yychar is either YYEMPTY or YYEOF
  796.      or a valid token in external form.  */
  797.  
  798.   if (yychar == YYEMPTY)
  799.     {
  800. #if YYDEBUG != 0
  801.       if (yydebug)
  802.     fprintf(stderr, "Reading a token: ");
  803. #endif
  804.       yychar = YYLEX;
  805.     }
  806.  
  807.   /* Convert token to internal form (in yychar1) for indexing tables with */
  808.  
  809.   if (yychar <= 0)        /* This means end of input. */
  810.     {
  811.       yychar1 = 0;
  812.       yychar = YYEOF;        /* Don't call YYLEX any more */
  813.  
  814. #if YYDEBUG != 0
  815.       if (yydebug)
  816.     fprintf(stderr, "Now at end of input.\n");
  817. #endif
  818.     }
  819.   else
  820.     {
  821.       yychar1 = YYTRANSLATE(yychar);
  822.  
  823. #if YYDEBUG != 0
  824.       if (yydebug)
  825.     fprintf(stderr, "Next token is %d (%s)\n", yychar, yytname[yychar1]);
  826. #endif
  827.     }
  828.  
  829.   yyn += yychar1;
  830.   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
  831.     goto yydefault;
  832.  
  833.   yyn = yytable[yyn];
  834.  
  835.   /* yyn is what to do for this token type in this state.
  836.      Negative => reduce, -yyn is rule number.
  837.      Positive => shift, yyn is new state.
  838.        New state is final state => don't bother to shift,
  839.        just return success.
  840.      0, or most negative number => error.  */
  841.  
  842.   if (yyn < 0)
  843.     {
  844.       if (yyn == YYFLAG)
  845.     goto yyerrlab;
  846.       yyn = -yyn;
  847.       goto yyreduce;
  848.     }
  849.   else if (yyn == 0)
  850.     goto yyerrlab;
  851.  
  852.   if (yyn == YYFINAL)
  853.     YYACCEPT;
  854.  
  855.   /* Shift the lookahead token.  */
  856.  
  857. #if YYDEBUG != 0
  858.   if (yydebug)
  859.     fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
  860. #endif
  861.  
  862.   /* Discard the token being shifted unless it is eof.  */
  863.   if (yychar != YYEOF)
  864.     yychar = YYEMPTY;
  865.  
  866.   *++yyvsp = yylval;
  867. #ifdef YYLSP_NEEDED
  868.   *++yylsp = yylloc;
  869. #endif
  870.  
  871.   /* count tokens shifted since error; after three, turn off error status.  */
  872.   if (yyerrstatus) yyerrstatus--;
  873.  
  874.   yystate = yyn;
  875.   goto yynewstate;
  876.  
  877. /* Do the default action for the current state.  */
  878. yydefault:
  879.  
  880.   yyn = yydefact[yystate];
  881.   if (yyn == 0)
  882.     goto yyerrlab;
  883.  
  884. /* Do a reduction.  yyn is the number of a rule to reduce with.  */
  885. yyreduce:
  886.   yylen = yyr2[yyn];
  887.   yyval = yyvsp[1-yylen]; /* implement default value of the action */
  888.  
  889. #if YYDEBUG != 0
  890.   if (yydebug)
  891.     {
  892.       int i;
  893.  
  894.       fprintf (stderr, "Reducing via rule %d (line %d), ",
  895.            yyn, yyrline[yyn]);
  896.  
  897.       /* Print the symboles being reduced, and their result.  */
  898.       for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
  899.     fprintf (stderr, "%s ", yytname[yyrhs[i]]);
  900.       fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
  901.     }
  902. #endif
  903.  
  904.  
  905.   switch (yyn) {
  906.  
  907. case 3:
  908. #line 181 "./c-exp.y"
  909. { write_exp_elt_opcode(OP_TYPE);
  910.               write_exp_elt_type(yyvsp[0].tval);
  911.               write_exp_elt_opcode(OP_TYPE);;
  912.     break;}
  913. case 5:
  914. #line 189 "./c-exp.y"
  915. { write_exp_elt_opcode (BINOP_COMMA); ;
  916.     break;}
  917. case 6:
  918. #line 194 "./c-exp.y"
  919. { write_exp_elt_opcode (UNOP_IND); ;
  920.     break;}
  921. case 7:
  922. #line 197 "./c-exp.y"
  923. { write_exp_elt_opcode (UNOP_ADDR); ;
  924.     break;}
  925. case 8:
  926. #line 200 "./c-exp.y"
  927. { write_exp_elt_opcode (UNOP_NEG); ;
  928.     break;}
  929. case 9:
  930. #line 204 "./c-exp.y"
  931. { write_exp_elt_opcode (UNOP_ZEROP); ;
  932.     break;}
  933. case 10:
  934. #line 208 "./c-exp.y"
  935. { write_exp_elt_opcode (UNOP_LOGNOT); ;
  936.     break;}
  937. case 11:
  938. #line 212 "./c-exp.y"
  939. { write_exp_elt_opcode (UNOP_PREINCREMENT); ;
  940.     break;}
  941. case 12:
  942. #line 216 "./c-exp.y"
  943. { write_exp_elt_opcode (UNOP_PREDECREMENT); ;
  944.     break;}
  945. case 13:
  946. #line 220 "./c-exp.y"
  947. { write_exp_elt_opcode (UNOP_POSTINCREMENT); ;
  948.     break;}
  949. case 14:
  950. #line 224 "./c-exp.y"
  951. { write_exp_elt_opcode (UNOP_POSTDECREMENT); ;
  952.     break;}
  953. case 15:
  954. #line 228 "./c-exp.y"
  955. { write_exp_elt_opcode (UNOP_SIZEOF); ;
  956.     break;}
  957. case 16:
  958. #line 232 "./c-exp.y"
  959. { write_exp_elt_opcode (STRUCTOP_PTR);
  960.               write_exp_string (yyvsp[0].sval);
  961.               write_exp_elt_opcode (STRUCTOP_PTR); ;
  962.     break;}
  963. case 17:
  964. #line 238 "./c-exp.y"
  965. { write_exp_elt_opcode (STRUCTOP_MPTR); ;
  966.     break;}
  967. case 18:
  968. #line 242 "./c-exp.y"
  969. { write_exp_elt_opcode (STRUCTOP_STRUCT);
  970.               write_exp_string (yyvsp[0].sval);
  971.               write_exp_elt_opcode (STRUCTOP_STRUCT); ;
  972.     break;}
  973. case 19:
  974. #line 248 "./c-exp.y"
  975. { write_exp_elt_opcode (STRUCTOP_MEMBER); ;
  976.     break;}
  977. case 20:
  978. #line 252 "./c-exp.y"
  979. { write_exp_elt_opcode (BINOP_SUBSCRIPT); ;
  980.     break;}
  981. case 21:
  982. #line 258 "./c-exp.y"
  983. { start_arglist (); ;
  984.     break;}
  985. case 22:
  986. #line 260 "./c-exp.y"
  987. { write_exp_elt_opcode (OP_FUNCALL);
  988.               write_exp_elt_longcst ((LONGEST) end_arglist ());
  989.               write_exp_elt_opcode (OP_FUNCALL); ;
  990.     break;}
  991. case 24:
  992. #line 269 "./c-exp.y"
  993. { arglist_len = 1; ;
  994.     break;}
  995. case 25:
  996. #line 273 "./c-exp.y"
  997. { arglist_len++; ;
  998.     break;}
  999. case 26:
  1000. #line 277 "./c-exp.y"
  1001. { write_exp_elt_opcode (UNOP_MEMVAL);
  1002.               write_exp_elt_type (yyvsp[-2].tval);
  1003.               write_exp_elt_opcode (UNOP_MEMVAL); ;
  1004.     break;}
  1005. case 27:
  1006. #line 283 "./c-exp.y"
  1007. { write_exp_elt_opcode (UNOP_CAST);
  1008.               write_exp_elt_type (yyvsp[-2].tval);
  1009.               write_exp_elt_opcode (UNOP_CAST); ;
  1010.     break;}
  1011. case 28:
  1012. #line 289 "./c-exp.y"
  1013. { ;
  1014.     break;}
  1015. case 29:
  1016. #line 295 "./c-exp.y"
  1017. { write_exp_elt_opcode (BINOP_REPEAT); ;
  1018.     break;}
  1019. case 30:
  1020. #line 299 "./c-exp.y"
  1021. { write_exp_elt_opcode (BINOP_MUL); ;
  1022.     break;}
  1023. case 31:
  1024. #line 303 "./c-exp.y"
  1025. { write_exp_elt_opcode (BINOP_DIV); ;
  1026.     break;}
  1027. case 32:
  1028. #line 307 "./c-exp.y"
  1029. { write_exp_elt_opcode (BINOP_REM); ;
  1030.     break;}
  1031. case 33:
  1032. #line 311 "./c-exp.y"
  1033. { write_exp_elt_opcode (BINOP_ADD); ;
  1034.     break;}
  1035. case 34:
  1036. #line 315 "./c-exp.y"
  1037. { write_exp_elt_opcode (BINOP_SUB); ;
  1038.     break;}
  1039. case 35:
  1040. #line 319 "./c-exp.y"
  1041. { write_exp_elt_opcode (BINOP_LSH); ;
  1042.     break;}
  1043. case 36:
  1044. #line 323 "./c-exp.y"
  1045. { write_exp_elt_opcode (BINOP_RSH); ;
  1046.     break;}
  1047. case 37:
  1048. #line 327 "./c-exp.y"
  1049. { write_exp_elt_opcode (BINOP_EQUAL); ;
  1050.     break;}
  1051. case 38:
  1052. #line 331 "./c-exp.y"
  1053. { write_exp_elt_opcode (BINOP_NOTEQUAL); ;
  1054.     break;}
  1055. case 39:
  1056. #line 335 "./c-exp.y"
  1057. { write_exp_elt_opcode (BINOP_LEQ); ;
  1058.     break;}
  1059. case 40:
  1060. #line 339 "./c-exp.y"
  1061. { write_exp_elt_opcode (BINOP_GEQ); ;
  1062.     break;}
  1063. case 41:
  1064. #line 343 "./c-exp.y"
  1065. { write_exp_elt_opcode (BINOP_LESS); ;
  1066.     break;}
  1067. case 42:
  1068. #line 347 "./c-exp.y"
  1069. { write_exp_elt_opcode (BINOP_GTR); ;
  1070.     break;}
  1071. case 43:
  1072. #line 351 "./c-exp.y"
  1073. { write_exp_elt_opcode (BINOP_LOGAND); ;
  1074.     break;}
  1075. case 44:
  1076. #line 355 "./c-exp.y"
  1077. { write_exp_elt_opcode (BINOP_LOGXOR); ;
  1078.     break;}
  1079. case 45:
  1080. #line 359 "./c-exp.y"
  1081. { write_exp_elt_opcode (BINOP_LOGIOR); ;
  1082.     break;}
  1083. case 46:
  1084. #line 363 "./c-exp.y"
  1085. { write_exp_elt_opcode (BINOP_AND); ;
  1086.     break;}
  1087. case 47:
  1088. #line 367 "./c-exp.y"
  1089. { write_exp_elt_opcode (BINOP_OR); ;
  1090.     break;}
  1091. case 48:
  1092. #line 371 "./c-exp.y"
  1093. { write_exp_elt_opcode (TERNOP_COND); ;
  1094.     break;}
  1095. case 49:
  1096. #line 375 "./c-exp.y"
  1097. { write_exp_elt_opcode (BINOP_ASSIGN); ;
  1098.     break;}
  1099. case 50:
  1100. #line 379 "./c-exp.y"
  1101. { write_exp_elt_opcode (BINOP_ASSIGN_MODIFY);
  1102.               write_exp_elt_opcode (yyvsp[-1].opcode);
  1103.               write_exp_elt_opcode (BINOP_ASSIGN_MODIFY); ;
  1104.     break;}
  1105. case 51:
  1106. #line 385 "./c-exp.y"
  1107. { write_exp_elt_opcode (OP_LONG);
  1108.               if (yyvsp[0].lval == (int) yyvsp[0].lval || yyvsp[0].lval == (unsigned int) yyvsp[0].lval)
  1109.                 write_exp_elt_type (builtin_type_int);
  1110.               else
  1111.                 write_exp_elt_type (BUILTIN_TYPE_LONGEST);
  1112.               write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
  1113.               write_exp_elt_opcode (OP_LONG); ;
  1114.     break;}
  1115. case 52:
  1116. #line 395 "./c-exp.y"
  1117. { YYSTYPE val;
  1118.               parse_number (yyvsp[0].ssym.stoken.ptr, yyvsp[0].ssym.stoken.length, 0, &val);
  1119.               write_exp_elt_opcode (OP_LONG);
  1120.               if (val.lval == (int) val.lval ||
  1121.                   val.lval == (unsigned int) val.lval)
  1122.                 write_exp_elt_type (builtin_type_int);
  1123.               else
  1124.                 write_exp_elt_type (BUILTIN_TYPE_LONGEST);
  1125.               write_exp_elt_longcst (val.lval);
  1126.               write_exp_elt_opcode (OP_LONG); ;
  1127.     break;}
  1128. case 53:
  1129. #line 408 "./c-exp.y"
  1130. {
  1131.               write_exp_elt_opcode (OP_LONG);
  1132.               if (yyvsp[0].ulval == (unsigned int) yyvsp[0].ulval)
  1133.                 write_exp_elt_type (builtin_type_unsigned_int);
  1134.               else
  1135.                 write_exp_elt_type (BUILTIN_TYPE_UNSIGNED_LONGEST);
  1136.               write_exp_elt_longcst ((LONGEST) yyvsp[0].ulval);
  1137.               write_exp_elt_opcode (OP_LONG);
  1138.             ;
  1139.     break;}
  1140. case 54:
  1141. #line 420 "./c-exp.y"
  1142. { YYSTYPE val;
  1143.               parse_number (yyvsp[0].ssym.stoken.ptr, yyvsp[0].ssym.stoken.length, 0, &val);
  1144.               write_exp_elt_opcode (OP_LONG);
  1145.               if (val.ulval == (unsigned int) val.ulval)
  1146.                 write_exp_elt_type (builtin_type_unsigned_int);
  1147.               else
  1148.                 write_exp_elt_type (BUILTIN_TYPE_UNSIGNED_LONGEST);
  1149.               write_exp_elt_longcst ((LONGEST)val.ulval);
  1150.               write_exp_elt_opcode (OP_LONG);
  1151.             ;
  1152.     break;}
  1153. case 55:
  1154. #line 433 "./c-exp.y"
  1155. { write_exp_elt_opcode (OP_LONG);
  1156.               write_exp_elt_type (builtin_type_char);
  1157.               write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
  1158.               write_exp_elt_opcode (OP_LONG); ;
  1159.     break;}
  1160. case 56:
  1161. #line 440 "./c-exp.y"
  1162. { write_exp_elt_opcode (OP_DOUBLE);
  1163.               write_exp_elt_type (builtin_type_double);
  1164.               write_exp_elt_dblcst (yyvsp[0].dval);
  1165.               write_exp_elt_opcode (OP_DOUBLE); ;
  1166.     break;}
  1167. case 58:
  1168. #line 450 "./c-exp.y"
  1169. { write_exp_elt_opcode (OP_LAST);
  1170.               write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
  1171.               write_exp_elt_opcode (OP_LAST); ;
  1172.     break;}
  1173. case 59:
  1174. #line 456 "./c-exp.y"
  1175. { write_exp_elt_opcode (OP_REGISTER);
  1176.               write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
  1177.               write_exp_elt_opcode (OP_REGISTER); ;
  1178.     break;}
  1179. case 60:
  1180. #line 462 "./c-exp.y"
  1181. { write_exp_elt_opcode (OP_INTERNALVAR);
  1182.               write_exp_elt_intern (yyvsp[0].ivar);
  1183.               write_exp_elt_opcode (OP_INTERNALVAR); ;
  1184.     break;}
  1185. case 61:
  1186. #line 468 "./c-exp.y"
  1187. { write_exp_elt_opcode (OP_LONG);
  1188.               write_exp_elt_type (builtin_type_int);
  1189.               write_exp_elt_longcst ((LONGEST) TYPE_LENGTH (yyvsp[-1].tval));
  1190.               write_exp_elt_opcode (OP_LONG); ;
  1191.     break;}
  1192. case 62:
  1193. #line 475 "./c-exp.y"
  1194. { write_exp_elt_opcode (OP_STRING);
  1195.               write_exp_string (yyvsp[0].sval);
  1196.               write_exp_elt_opcode (OP_STRING); ;
  1197.     break;}
  1198. case 63:
  1199. #line 482 "./c-exp.y"
  1200. { write_exp_elt_opcode (OP_THIS);
  1201.               write_exp_elt_opcode (OP_THIS); ;
  1202.     break;}
  1203. case 64:
  1204. #line 489 "./c-exp.y"
  1205. {
  1206.               if (yyvsp[0].ssym.sym != 0)
  1207.                   yyval.bval = SYMBOL_BLOCK_VALUE (yyvsp[0].ssym.sym);
  1208.               else
  1209.                 {
  1210.                   struct symtab *tem =
  1211.                   lookup_symtab (copy_name (yyvsp[0].ssym.stoken));
  1212.                   if (tem)
  1213.                 yyval.bval = BLOCKVECTOR_BLOCK
  1214.                      (BLOCKVECTOR (tem), STATIC_BLOCK);
  1215.                   else
  1216.                 error ("No file or function \"%s\".",
  1217.                        copy_name (yyvsp[0].ssym.stoken));
  1218.                 }
  1219.             ;
  1220.     break;}
  1221. case 65:
  1222. #line 507 "./c-exp.y"
  1223. { struct symbol *tem
  1224.                 = lookup_symbol (copy_name (yyvsp[0].sval), yyvsp[-2].bval,
  1225.                          VAR_NAMESPACE, 0, NULL);
  1226.               if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK)
  1227.                 error ("No function \"%s\" in specified context.",
  1228.                    copy_name (yyvsp[0].sval));
  1229.               yyval.bval = SYMBOL_BLOCK_VALUE (tem); ;
  1230.     break;}
  1231. case 66:
  1232. #line 517 "./c-exp.y"
  1233. { struct symbol *sym;
  1234.               sym = lookup_symbol (copy_name (yyvsp[0].sval), yyvsp[-2].bval,
  1235.                            VAR_NAMESPACE, 0, NULL);
  1236.               if (sym == 0)
  1237.                 error ("No symbol \"%s\" in specified context.",
  1238.                    copy_name (yyvsp[0].sval));
  1239.  
  1240.               write_exp_elt_opcode (OP_VAR_VALUE);
  1241.               write_exp_elt_sym (sym);
  1242.               write_exp_elt_opcode (OP_VAR_VALUE); ;
  1243.     break;}
  1244. case 67:
  1245. #line 530 "./c-exp.y"
  1246. {
  1247.               struct type *type = yyvsp[-2].tval;
  1248.               if (TYPE_CODE (type) != TYPE_CODE_STRUCT
  1249.                   && TYPE_CODE (type) != TYPE_CODE_UNION)
  1250.                 error ("`%s' is not defined as an aggregate type.",
  1251.                    TYPE_NAME (type));
  1252.  
  1253.               write_exp_elt_opcode (OP_SCOPE);
  1254.               write_exp_elt_type (type);
  1255.               write_exp_string (yyvsp[0].sval);
  1256.               write_exp_elt_opcode (OP_SCOPE);
  1257.             ;
  1258.     break;}
  1259. case 68:
  1260. #line 543 "./c-exp.y"
  1261. {
  1262.               struct type *type = yyvsp[-3].tval;
  1263.               if (TYPE_CODE (type) != TYPE_CODE_STRUCT
  1264.                   && TYPE_CODE (type) != TYPE_CODE_UNION)
  1265.                 error ("`%s' is not defined as an aggregate type.",
  1266.                    TYPE_NAME (type));
  1267.  
  1268.               if (strcmp (type_name_no_tag (type), yyvsp[0].sval.ptr))
  1269.                 error ("invalid destructor `%s::~%s'",
  1270.                    type_name_no_tag (type), yyvsp[0].sval.ptr);
  1271.  
  1272.               write_exp_elt_opcode (OP_SCOPE);
  1273.               write_exp_elt_type (type);
  1274.               write_exp_string (yyvsp[0].sval);
  1275.               write_exp_elt_opcode (OP_SCOPE);
  1276.               write_exp_elt_opcode (UNOP_LOGNOT);
  1277.             ;
  1278.     break;}
  1279. case 69:
  1280. #line 561 "./c-exp.y"
  1281. {
  1282.               char *name = copy_name (yyvsp[0].sval);
  1283.               struct symbol *sym;
  1284.               int i;
  1285.  
  1286.               sym =
  1287.                 lookup_symbol (name, 0, VAR_NAMESPACE, 0, NULL);
  1288.               if (sym)
  1289.                 {
  1290.                   write_exp_elt_opcode (OP_VAR_VALUE);
  1291.                   write_exp_elt_sym (sym);
  1292.                   write_exp_elt_opcode (OP_VAR_VALUE);
  1293.                   break;
  1294.                 }
  1295.               for (i = 0; i < misc_function_count; i++)
  1296.                 if (!strcmp (misc_function_vector[i].name, name))
  1297.                   break;
  1298.  
  1299.               if (i < misc_function_count)
  1300.                 {
  1301.                   enum misc_function_type mft =
  1302.                   misc_function_vector[i].type;
  1303.                   
  1304.                   write_exp_elt_opcode (OP_LONG);
  1305.                   write_exp_elt_type (builtin_type_int);
  1306.                   write_exp_elt_longcst ((LONGEST) misc_function_vector[i].address);
  1307.                   write_exp_elt_opcode (OP_LONG);
  1308.                   write_exp_elt_opcode (UNOP_MEMVAL);
  1309.                   if (mft == mf_data || mft == mf_bss)
  1310.                 write_exp_elt_type (builtin_type_int);
  1311.                   else if (mft == mf_text)
  1312.                 write_exp_elt_type (lookup_function_type (builtin_type_int));
  1313.                   else
  1314.                 write_exp_elt_type (builtin_type_char);
  1315.                   write_exp_elt_opcode (UNOP_MEMVAL);
  1316.                 }
  1317.               else
  1318.                 if (symtab_list == 0
  1319.                 && partial_symtab_list == 0)
  1320.                   error ("No symbol table is loaded.  Use the \"file\" command.");
  1321.                 else
  1322.                   error ("No symbol \"%s\" in current context.", name);
  1323.             ;
  1324.     break;}
  1325. case 70:
  1326. #line 607 "./c-exp.y"
  1327. { struct symbol *sym = yyvsp[0].ssym.sym;
  1328.  
  1329.               if (sym)
  1330.                 {
  1331.                   switch (SYMBOL_CLASS (sym))
  1332.                 {
  1333.                 case LOC_REGISTER:
  1334.                 case LOC_ARG:
  1335.                 case LOC_REF_ARG:
  1336.                 case LOC_REGPARM:
  1337.                 case LOC_LOCAL:
  1338.                 case LOC_LOCAL_ARG:
  1339.                   if (innermost_block == 0 ||
  1340.                       contained_in (block_found, 
  1341.                             innermost_block))
  1342.                     innermost_block = block_found;
  1343.                 case LOC_UNDEF:
  1344.                 case LOC_CONST:
  1345.                 case LOC_STATIC:
  1346.                 case LOC_TYPEDEF:
  1347.                 case LOC_LABEL:
  1348.                 case LOC_BLOCK:
  1349.                 case LOC_CONST_BYTES:
  1350.  
  1351.                   /* In this case the expression can
  1352.                      be evaluated regardless of what
  1353.                      frame we are in, so there is no
  1354.                      need to check for the
  1355.                      innermost_block.  These cases are
  1356.                      listed so that gcc -Wall will
  1357.                      report types that may not have
  1358.                      been considered.  */
  1359.  
  1360.                   break;
  1361.                 }
  1362.                   write_exp_elt_opcode (OP_VAR_VALUE);
  1363.                   write_exp_elt_sym (sym);
  1364.                   write_exp_elt_opcode (OP_VAR_VALUE);
  1365.                 }
  1366.               else if (yyvsp[0].ssym.is_a_field_of_this)
  1367.                 {
  1368.                   /* C++: it hangs off of `this'.  Must
  1369.                      not inadvertently convert from a method call
  1370.                  to data ref.  */
  1371.                   if (innermost_block == 0 || 
  1372.                   contained_in (block_found, innermost_block))
  1373.                 innermost_block = block_found;
  1374.                   write_exp_elt_opcode (OP_THIS);
  1375.                   write_exp_elt_opcode (OP_THIS);
  1376.                   write_exp_elt_opcode (STRUCTOP_PTR);
  1377.                   write_exp_string (yyvsp[0].ssym.stoken);
  1378.                   write_exp_elt_opcode (STRUCTOP_PTR);
  1379.                 }
  1380.               else
  1381.                 {
  1382.                   register int i;
  1383.                   register char *arg = copy_name (yyvsp[0].ssym.stoken);
  1384.  
  1385.                 /* FIXME, this search is linear!  At least
  1386.                    optimize the strcmp with a 1-char cmp... */
  1387.                   for (i = 0; i < misc_function_count; i++)
  1388.                 if (!strcmp (misc_function_vector[i].name, arg))
  1389.                   break;
  1390.  
  1391.                   if (i < misc_function_count)
  1392.                 {
  1393.                   enum misc_function_type mft =
  1394.                       misc_function_vector[i].type;
  1395.                   
  1396.                   write_exp_elt_opcode (OP_LONG);
  1397.                   write_exp_elt_type (builtin_type_int);
  1398.                   write_exp_elt_longcst ((LONGEST) misc_function_vector[i].address);
  1399.                   write_exp_elt_opcode (OP_LONG);
  1400.                   write_exp_elt_opcode (UNOP_MEMVAL);
  1401.                   if (mft == mf_data || mft == mf_bss)
  1402.                     write_exp_elt_type (builtin_type_int);
  1403.                   else if (mft == mf_text)
  1404.                     write_exp_elt_type (lookup_function_type (builtin_type_int));
  1405.                   else
  1406.                     write_exp_elt_type (builtin_type_char);
  1407.                   write_exp_elt_opcode (UNOP_MEMVAL);
  1408.                 }
  1409.                   else if (symtab_list == 0
  1410.                        && partial_symtab_list == 0)
  1411.                 error ("No symbol table is loaded.  Use the \"file\" command.");
  1412.                   else
  1413.                 error ("No symbol \"%s\" in current context.",
  1414.                        copy_name (yyvsp[0].ssym.stoken));
  1415.                 }
  1416.             ;
  1417.     break;}
  1418. case 72:
  1419. #line 702 "./c-exp.y"
  1420. {
  1421.           /* This is where the interesting stuff happens.  */
  1422.           int done = 0;
  1423.           int array_size;
  1424.           struct type *follow_type = yyvsp[-1].tval;
  1425.           
  1426.           while (!done)
  1427.             switch (pop_type ())
  1428.               {
  1429.               case tp_end:
  1430.             done = 1;
  1431.             break;
  1432.               case tp_pointer:
  1433.             follow_type = lookup_pointer_type (follow_type);
  1434.             break;
  1435.               case tp_reference:
  1436.             follow_type = lookup_reference_type (follow_type);
  1437.             break;
  1438.               case tp_array:
  1439.             array_size = pop_type_int ();
  1440.             if (array_size != -1)
  1441.               follow_type = create_array_type (follow_type,
  1442.                                array_size);
  1443.             else
  1444.               follow_type = lookup_pointer_type (follow_type);
  1445.             break;
  1446.               case tp_function:
  1447.             follow_type = lookup_function_type (follow_type);
  1448.             break;
  1449.               }
  1450.           yyval.tval = follow_type;
  1451.         ;
  1452.     break;}
  1453. case 73:
  1454. #line 737 "./c-exp.y"
  1455. { push_type (tp_pointer); yyval.voidval = 0; ;
  1456.     break;}
  1457. case 74:
  1458. #line 739 "./c-exp.y"
  1459. { push_type (tp_pointer); yyval.voidval = yyvsp[0].voidval; ;
  1460.     break;}
  1461. case 75:
  1462. #line 741 "./c-exp.y"
  1463. { push_type (tp_reference); yyval.voidval = 0; ;
  1464.     break;}
  1465. case 76:
  1466. #line 743 "./c-exp.y"
  1467. { push_type (tp_reference); yyval.voidval = yyvsp[0].voidval; ;
  1468.     break;}
  1469. case 78:
  1470. #line 748 "./c-exp.y"
  1471. { yyval.voidval = yyvsp[-1].voidval; ;
  1472.     break;}
  1473. case 79:
  1474. #line 750 "./c-exp.y"
  1475. {
  1476.               push_type_int (yyvsp[0].lval);
  1477.               push_type (tp_array);
  1478.             ;
  1479.     break;}
  1480. case 80:
  1481. #line 755 "./c-exp.y"
  1482. {
  1483.               push_type_int (yyvsp[0].lval);
  1484.               push_type (tp_array);
  1485.               yyval.voidval = 0;
  1486.             ;
  1487.     break;}
  1488. case 81:
  1489. #line 761 "./c-exp.y"
  1490. { push_type (tp_function); ;
  1491.     break;}
  1492. case 82:
  1493. #line 763 "./c-exp.y"
  1494. { push_type (tp_function); ;
  1495.     break;}
  1496. case 83:
  1497. #line 767 "./c-exp.y"
  1498. { yyval.lval = -1; ;
  1499.     break;}
  1500. case 84:
  1501. #line 769 "./c-exp.y"
  1502. { yyval.lval = yyvsp[-1].lval; ;
  1503.     break;}
  1504. case 85:
  1505. #line 773 "./c-exp.y"
  1506. { yyval.voidval = 0; ;
  1507.     break;}
  1508. case 87:
  1509. #line 778 "./c-exp.y"
  1510. { yyval.tval = lookup_member_type (builtin_type_int, yyvsp[-2].tval); ;
  1511.     break;}
  1512. case 88:
  1513. #line 780 "./c-exp.y"
  1514. { yyval.tval = lookup_member_type (yyvsp[-5].tval, yyvsp[-3].tval); ;
  1515.     break;}
  1516. case 89:
  1517. #line 782 "./c-exp.y"
  1518. { yyval.tval = lookup_member_type
  1519.                 (lookup_function_type (yyvsp[-7].tval), yyvsp[-5].tval); ;
  1520.     break;}
  1521. case 90:
  1522. #line 785 "./c-exp.y"
  1523. { yyval.tval = lookup_member_type
  1524.                 (lookup_function_type (yyvsp[-8].tval), yyvsp[-6].tval);
  1525.               free (yyvsp[-1].tvec); ;
  1526.     break;}
  1527. case 91:
  1528. #line 792 "./c-exp.y"
  1529. { yyval.tval = yyvsp[0].tsym.type; ;
  1530.     break;}
  1531. case 92:
  1532. #line 794 "./c-exp.y"
  1533. { yyval.tval = builtin_type_int; ;
  1534.     break;}
  1535. case 93:
  1536. #line 796 "./c-exp.y"
  1537. { yyval.tval = builtin_type_long; ;
  1538.     break;}
  1539. case 94:
  1540. #line 798 "./c-exp.y"
  1541. { yyval.tval = builtin_type_short; ;
  1542.     break;}
  1543. case 95:
  1544. #line 800 "./c-exp.y"
  1545. { yyval.tval = builtin_type_long; ;
  1546.     break;}
  1547. case 96:
  1548. #line 802 "./c-exp.y"
  1549. { yyval.tval = builtin_type_unsigned_long; ;
  1550.     break;}
  1551. case 97:
  1552. #line 804 "./c-exp.y"
  1553. { yyval.tval = builtin_type_long_long; ;
  1554.     break;}
  1555. case 98:
  1556. #line 806 "./c-exp.y"
  1557. { yyval.tval = builtin_type_long_long; ;
  1558.     break;}
  1559. case 99:
  1560. #line 808 "./c-exp.y"
  1561. { yyval.tval = builtin_type_unsigned_long_long; ;
  1562.     break;}
  1563. case 100:
  1564. #line 810 "./c-exp.y"
  1565. { yyval.tval = builtin_type_unsigned_long_long; ;
  1566.     break;}
  1567. case 101:
  1568. #line 812 "./c-exp.y"
  1569. { yyval.tval = builtin_type_short; ;
  1570.     break;}
  1571. case 102:
  1572. #line 814 "./c-exp.y"
  1573. { yyval.tval = builtin_type_unsigned_short; ;
  1574.     break;}
  1575. case 103:
  1576. #line 816 "./c-exp.y"
  1577. { yyval.tval = lookup_struct (copy_name (yyvsp[0].sval),
  1578.                           expression_context_block); ;
  1579.     break;}
  1580. case 104:
  1581. #line 819 "./c-exp.y"
  1582. { yyval.tval = lookup_union (copy_name (yyvsp[0].sval),
  1583.                          expression_context_block); ;
  1584.     break;}
  1585. case 105:
  1586. #line 822 "./c-exp.y"
  1587. { yyval.tval = lookup_enum (copy_name (yyvsp[0].sval),
  1588.                         expression_context_block); ;
  1589.     break;}
  1590. case 106:
  1591. #line 825 "./c-exp.y"
  1592. { yyval.tval = lookup_unsigned_typename (TYPE_NAME(yyvsp[0].tsym.type)); ;
  1593.     break;}
  1594. case 107:
  1595. #line 827 "./c-exp.y"
  1596. { yyval.tval = builtin_type_unsigned_int; ;
  1597.     break;}
  1598. case 108:
  1599. #line 829 "./c-exp.y"
  1600. { yyval.tval = yyvsp[0].tsym.type; ;
  1601.     break;}
  1602. case 109:
  1603. #line 831 "./c-exp.y"
  1604. { yyval.tval = builtin_type_int; ;
  1605.     break;}
  1606. case 111:
  1607. #line 836 "./c-exp.y"
  1608. {
  1609.           yyval.tsym.stoken.ptr = "int";
  1610.           yyval.tsym.stoken.length = 3;
  1611.           yyval.tsym.type = builtin_type_int;
  1612.         ;
  1613.     break;}
  1614. case 112:
  1615. #line 842 "./c-exp.y"
  1616. {
  1617.           yyval.tsym.stoken.ptr = "long";
  1618.           yyval.tsym.stoken.length = 4;
  1619.           yyval.tsym.type = builtin_type_long;
  1620.         ;
  1621.     break;}
  1622. case 113:
  1623. #line 848 "./c-exp.y"
  1624. {
  1625.           yyval.tsym.stoken.ptr = "short";
  1626.           yyval.tsym.stoken.length = 5;
  1627.           yyval.tsym.type = builtin_type_short;
  1628.         ;
  1629.     break;}
  1630. case 114:
  1631. #line 857 "./c-exp.y"
  1632. { yyval.tvec = (struct type **)xmalloc (sizeof (struct type *) * 2);
  1633.           yyval.tvec[0] = (struct type *)0;
  1634.           yyval.tvec[1] = yyvsp[0].tval;
  1635.         ;
  1636.     break;}
  1637. case 115:
  1638. #line 862 "./c-exp.y"
  1639. { int len = sizeof (struct type *) * ++(yyvsp[-2].ivec[0]);
  1640.           yyval.tvec = (struct type **)xrealloc (yyvsp[-2].tvec, len);
  1641.           yyval.tvec[yyval.ivec[0]] = yyvsp[0].tval;
  1642.         ;
  1643.     break;}
  1644. case 116:
  1645. #line 868 "./c-exp.y"
  1646. { yyval.sval = yyvsp[0].ssym.stoken; ;
  1647.     break;}
  1648. case 117:
  1649. #line 869 "./c-exp.y"
  1650. { yyval.sval = yyvsp[0].ssym.stoken; ;
  1651.     break;}
  1652. case 118:
  1653. #line 870 "./c-exp.y"
  1654. { yyval.sval = yyvsp[0].tsym.stoken; ;
  1655.     break;}
  1656. case 119:
  1657. #line 871 "./c-exp.y"
  1658. { yyval.sval = yyvsp[0].ssym.stoken; ;
  1659.     break;}
  1660. case 120:
  1661. #line 872 "./c-exp.y"
  1662. { yyval.sval = yyvsp[0].ssym.stoken; ;
  1663.     break;}
  1664. }
  1665.    /* the action file gets copied in in place of this dollarsign */
  1666. #line 423 "/usr/latest/lib/bison.simple"
  1667.  
  1668.   yyvsp -= yylen;
  1669.   yyssp -= yylen;
  1670. #ifdef YYLSP_NEEDED
  1671.   yylsp -= yylen;
  1672. #endif
  1673.  
  1674. #if YYDEBUG != 0
  1675.   if (yydebug)
  1676.     {
  1677.       short *ssp1 = yyss - 1;
  1678.       fprintf (stderr, "state stack now");
  1679.       while (ssp1 != yyssp)
  1680.     fprintf (stderr, " %d", *++ssp1);
  1681.       fprintf (stderr, "\n");
  1682.     }
  1683. #endif
  1684.  
  1685.   *++yyvsp = yyval;
  1686.  
  1687. #ifdef YYLSP_NEEDED
  1688.   yylsp++;
  1689.   if (yylen == 0)
  1690.     {
  1691.       yylsp->first_line = yylloc.first_line;
  1692.       yylsp->first_column = yylloc.first_column;
  1693.       yylsp->last_line = (yylsp-1)->last_line;
  1694.       yylsp->last_column = (yylsp-1)->last_column;
  1695.       yylsp->text = 0;
  1696.     }
  1697.   else
  1698.     {
  1699.       yylsp->last_line = (yylsp+yylen-1)->last_line;
  1700.       yylsp->last_column = (yylsp+yylen-1)->last_column;
  1701.     }
  1702. #endif
  1703.  
  1704.   /* Now "shift" the result of the reduction.
  1705.      Determine what state that goes to,
  1706.      based on the state we popped back to
  1707.      and the rule number reduced by.  */
  1708.  
  1709.   yyn = yyr1[yyn];
  1710.  
  1711.   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
  1712.   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
  1713.     yystate = yytable[yystate];
  1714.   else
  1715.     yystate = yydefgoto[yyn - YYNTBASE];
  1716.  
  1717.   goto yynewstate;
  1718.  
  1719. yyerrlab:   /* here on detecting error */
  1720.  
  1721.   if (! yyerrstatus)
  1722.     /* If not already recovering from an error, report this error.  */
  1723.     {
  1724.       ++yynerrs;
  1725.  
  1726. #ifdef YYERROR_VERBOSE
  1727.       yyn = yypact[yystate];
  1728.  
  1729.       if (yyn > YYFLAG && yyn < YYLAST)
  1730.     {
  1731.       int size = 0;
  1732.       char *msg;
  1733.       int x, count;
  1734.  
  1735.       count = 0;
  1736.       for (x = 0; x < (sizeof(yytname) / sizeof(char *)); x++)
  1737.         if (yycheck[x + yyn] == x)
  1738.           size += strlen(yytname[x]) + 15, count++;
  1739.       msg = (char *) xmalloc(size + 15);
  1740.       strcpy(msg, "parse error");
  1741.  
  1742.       if (count < 5)
  1743.         {
  1744.           count = 0;
  1745.           for (x = 0; x < (sizeof(yytname) / sizeof(char *)); x++)
  1746.         if (yycheck[x + yyn] == x)
  1747.           {
  1748.             strcat(msg, count == 0 ? ", expecting `" : " or `");
  1749.             strcat(msg, yytname[x]);
  1750.             strcat(msg, "'");
  1751.             count++;
  1752.           }
  1753.         }
  1754.       yyerror(msg);
  1755.       free(msg);
  1756.     }
  1757.       else
  1758. #endif /* YYERROR_VERBOSE */
  1759.     yyerror("parse error");
  1760.     }
  1761.  
  1762. yyerrlab1:   /* here on error raised explicitly by an action */
  1763.  
  1764.   if (yyerrstatus == 3)
  1765.     {
  1766.       /* if just tried and failed to reuse lookahead token after an error, discard it.  */
  1767.  
  1768.       /* return failure if at end of input */
  1769.       if (yychar == YYEOF)
  1770.     YYABORT;
  1771.  
  1772. #if YYDEBUG != 0
  1773.       if (yydebug)
  1774.     fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
  1775. #endif
  1776.  
  1777.       yychar = YYEMPTY;
  1778.     }
  1779.  
  1780.   /* Else will try to reuse lookahead token
  1781.      after shifting the error token.  */
  1782.  
  1783.   yyerrstatus = 3;        /* Each real token shifted decrements this */
  1784.  
  1785.   goto yyerrhandle;
  1786.  
  1787. yyerrdefault:  /* current state does not do anything special for the error token. */
  1788.  
  1789. #if 0
  1790.   /* This is wrong; only states that explicitly want error tokens
  1791.      should shift them.  */
  1792.   yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
  1793.   if (yyn) goto yydefault;
  1794. #endif
  1795.  
  1796. yyerrpop:   /* pop the current state because it cannot handle the error token */
  1797.  
  1798.   if (yyssp == yyss) YYABORT;
  1799.   yyvsp--;
  1800.   yystate = *--yyssp;
  1801. #ifdef YYLSP_NEEDED
  1802.   yylsp--;
  1803. #endif
  1804.  
  1805. #if YYDEBUG != 0
  1806.   if (yydebug)
  1807.     {
  1808.       short *ssp1 = yyss - 1;
  1809.       fprintf (stderr, "Error: state stack now");
  1810.       while (ssp1 != yyssp)
  1811.     fprintf (stderr, " %d", *++ssp1);
  1812.       fprintf (stderr, "\n");
  1813.     }
  1814. #endif
  1815.  
  1816. yyerrhandle:
  1817.  
  1818.   yyn = yypact[yystate];
  1819.   if (yyn == YYFLAG)
  1820.     goto yyerrdefault;
  1821.  
  1822.   yyn += YYTERROR;
  1823.   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
  1824.     goto yyerrdefault;
  1825.  
  1826.   yyn = yytable[yyn];
  1827.   if (yyn < 0)
  1828.     {
  1829.       if (yyn == YYFLAG)
  1830.     goto yyerrpop;
  1831.       yyn = -yyn;
  1832.       goto yyreduce;
  1833.     }
  1834.   else if (yyn == 0)
  1835.     goto yyerrpop;
  1836.  
  1837.   if (yyn == YYFINAL)
  1838.     YYACCEPT;
  1839.  
  1840. #if YYDEBUG != 0
  1841.   if (yydebug)
  1842.     fprintf(stderr, "Shifting error token, ");
  1843. #endif
  1844.  
  1845.   *++yyvsp = yylval;
  1846. #ifdef YYLSP_NEEDED
  1847.   *++yylsp = yylloc;
  1848. #endif
  1849.  
  1850.   yystate = yyn;
  1851.   goto yynewstate;
  1852. }
  1853. #line 887 "./c-exp.y"
  1854.  
  1855.  
  1856. /* Take care of parsing a number (anything that starts with a digit).
  1857.    Set yylval and return the token type; update lexptr.
  1858.    LEN is the number of characters in it.  */
  1859.  
  1860. /*** Needs some error checking for the float case ***/
  1861.  
  1862. static int
  1863. parse_number (p, len, parsed_float, putithere)
  1864.      register char *p;
  1865.      register int len;
  1866.      int parsed_float;
  1867.      YYSTYPE *putithere;
  1868. {
  1869.   register LONGEST n = 0;
  1870.   register LONGEST prevn = 0;
  1871.   register int i;
  1872.   register int c;
  1873.   register int base = input_radix;
  1874.   int unsigned_p = 0;
  1875.  
  1876.   extern double atof ();
  1877.  
  1878.   if (parsed_float)
  1879.     {
  1880.       /* It's a float since it contains a point or an exponent.  */
  1881.       putithere->dval = atof (p);
  1882.       return FLOAT;
  1883.     }
  1884.  
  1885.   /* Handle base-switching prefixes 0x, 0t, 0d, 0 */
  1886.   if (p[0] == '0')
  1887.     switch (p[1])
  1888.       {
  1889.       case 'x':
  1890.       case 'X':
  1891.     if (len >= 3)
  1892.       {
  1893.         p += 2;
  1894.         base = 16;
  1895.         len -= 2;
  1896.       }
  1897.     break;
  1898.  
  1899.       case 't':
  1900.       case 'T':
  1901.       case 'd':
  1902.       case 'D':
  1903.     if (len >= 3)
  1904.       {
  1905.         p += 2;
  1906.         base = 10;
  1907.         len -= 2;
  1908.       }
  1909.     break;
  1910.  
  1911.       default:
  1912.     base = 8;
  1913.     break;
  1914.       }
  1915.  
  1916.   while (len-- > 0)
  1917.     {
  1918.       c = *p++;
  1919.       if (c >= 'A' && c <= 'Z')
  1920.     c += 'a' - 'A';
  1921.       if (c != 'l' && c != 'u')
  1922.     n *= base;
  1923.       if (c >= '0' && c <= '9')
  1924.     n += i = c - '0';
  1925.       else
  1926.     {
  1927.       if (base > 10 && c >= 'a' && c <= 'f')
  1928.         n += i = c - 'a' + 10;
  1929.       else if (len == 0 && c == 'l')
  1930.         ;
  1931.       else if (len == 0 && c == 'u')
  1932.         unsigned_p = 1;
  1933.       else
  1934.         return ERROR;    /* Char not a digit */
  1935.     }
  1936.       if (i >= base)
  1937.     return ERROR;        /* Invalid digit in this base */
  1938.       if(!unsigned_p && (prevn >= n))
  1939.      unsigned_p=1;        /* Try something unsigned */
  1940.       /* Don't do the range check if n==i and i==0, since that special
  1941.      case will give an overflow error. */
  1942.       if(RANGE_CHECK && n!=0)
  1943.       {    
  1944.      if((unsigned_p && (unsigned)prevn >= (unsigned)n))
  1945.         range_error("Overflow on numeric constant.");     
  1946.       }
  1947.       prevn=n;
  1948.     }
  1949.  
  1950.   if (unsigned_p)
  1951.     {
  1952.       putithere->ulval = n;
  1953.       return UINT;
  1954.     }
  1955.   else
  1956.     {
  1957.       putithere->lval = n;
  1958.       return INT;
  1959.     }
  1960. }
  1961.  
  1962. struct token
  1963. {
  1964.   char *operator;
  1965.   int token;
  1966.   enum exp_opcode opcode;
  1967. };
  1968.  
  1969. const static struct token tokentab3[] =
  1970.   {
  1971.     {">>=", ASSIGN_MODIFY, BINOP_RSH},
  1972.     {"<<=", ASSIGN_MODIFY, BINOP_LSH}
  1973.   };
  1974.  
  1975. const static struct token tokentab2[] =
  1976.   {
  1977.     {"+=", ASSIGN_MODIFY, BINOP_ADD},
  1978.     {"-=", ASSIGN_MODIFY, BINOP_SUB},
  1979.     {"*=", ASSIGN_MODIFY, BINOP_MUL},
  1980.     {"/=", ASSIGN_MODIFY, BINOP_DIV},
  1981.     {"%=", ASSIGN_MODIFY, BINOP_REM},
  1982.     {"|=", ASSIGN_MODIFY, BINOP_LOGIOR},
  1983.     {"&=", ASSIGN_MODIFY, BINOP_LOGAND},
  1984.     {"^=", ASSIGN_MODIFY, BINOP_LOGXOR},
  1985.     {"++", INCREMENT, BINOP_END},
  1986.     {"--", DECREMENT, BINOP_END},
  1987.     {"->", ARROW, BINOP_END},
  1988.     {"&&", AND, BINOP_END},
  1989.     {"||", OR, BINOP_END},
  1990.     {"::", COLONCOLON, BINOP_END},
  1991.     {"<<", LSH, BINOP_END},
  1992.     {">>", RSH, BINOP_END},
  1993.     {"==", EQUAL, BINOP_END},
  1994.     {"!=", NOTEQUAL, BINOP_END},
  1995.     {"<=", LEQ, BINOP_END},
  1996.     {">=", GEQ, BINOP_END}
  1997.   };
  1998.  
  1999. /* Read one token, getting characters through lexptr.  */
  2000.  
  2001. int
  2002. yylex ()
  2003. {
  2004.   register int c;
  2005.   register int namelen;
  2006.   register unsigned i;
  2007.   register char *tokstart;
  2008.  
  2009.  retry:
  2010.  
  2011.   tokstart = lexptr;
  2012.   /* See if it is a special token of length 3.  */
  2013.   for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++)
  2014.     if (!strncmp (tokstart, tokentab3[i].operator, 3))
  2015.       {
  2016.     lexptr += 3;
  2017.     yylval.opcode = tokentab3[i].opcode;
  2018.     return tokentab3[i].token;
  2019.       }
  2020.  
  2021.   /* See if it is a special token of length 2.  */
  2022.   for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++)
  2023.     if (!strncmp (tokstart, tokentab2[i].operator, 2))
  2024.       {
  2025.     lexptr += 2;
  2026.     yylval.opcode = tokentab2[i].opcode;
  2027.     return tokentab2[i].token;
  2028.       }
  2029.  
  2030.   switch (c = *tokstart)
  2031.     {
  2032.     case 0:
  2033.       return 0;
  2034.  
  2035.     case ' ':
  2036.     case '\t':
  2037.     case '\n':
  2038.       lexptr++;
  2039.       goto retry;
  2040.  
  2041.     case '\'':
  2042.       lexptr++;
  2043.       c = *lexptr++;
  2044.       if (c == '\\')
  2045.     c = parse_escape (&lexptr);
  2046.       yylval.lval = c;
  2047.       c = *lexptr++;
  2048.       if (c != '\'')
  2049.     error ("Invalid character constant.");
  2050.       return CHAR;
  2051.  
  2052.     case '(':
  2053.       paren_depth++;
  2054.       lexptr++;
  2055.       return c;
  2056.  
  2057.     case ')':
  2058.       if (paren_depth == 0)
  2059.     return 0;
  2060.       paren_depth--;
  2061.       lexptr++;
  2062.       return c;
  2063.  
  2064.     case ',':
  2065.       if (comma_terminates && paren_depth == 0)
  2066.     return 0;
  2067.       lexptr++;
  2068.       return c;
  2069.  
  2070.     case '.':
  2071.       /* Might be a floating point number.  */
  2072.       if (lexptr[1] < '0' || lexptr[1] > '9')
  2073.     goto symbol;        /* Nope, must be a symbol. */
  2074.       /* FALL THRU into number case.  */
  2075.  
  2076.     case '0':
  2077.     case '1':
  2078.     case '2':
  2079.     case '3':
  2080.     case '4':
  2081.     case '5':
  2082.     case '6':
  2083.     case '7':
  2084.     case '8':
  2085.     case '9':
  2086.       {
  2087.     /* It's a number.  */
  2088.     int got_dot = 0, got_e = 0, toktype;
  2089.     register char *p = tokstart;
  2090.     int hex = input_radix > 10;
  2091.  
  2092.     if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
  2093.       {
  2094.         p += 2;
  2095.         hex = 1;
  2096.       }
  2097.     else if (c == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D'))
  2098.       {
  2099.         p += 2;
  2100.         hex = 0;
  2101.       }
  2102.  
  2103.     for (;; ++p)
  2104.       {
  2105.         if (!hex && !got_e && (*p == 'e' || *p == 'E'))
  2106.           got_dot = got_e = 1;
  2107.         else if (!hex && !got_dot && *p == '.')
  2108.           got_dot = 1;
  2109.         else if (got_e && (p[-1] == 'e' || p[-1] == 'E')
  2110.              && (*p == '-' || *p == '+'))
  2111.           /* This is the sign of the exponent, not the end of the
  2112.          number.  */
  2113.           continue;
  2114.         /* We will take any letters or digits.  parse_number will
  2115.            complain if past the radix, or if L or U are not final.  */
  2116.         else if ((*p < '0' || *p > '9')
  2117.              && ((*p < 'a' || *p > 'z')
  2118.                   && (*p < 'A' || *p > 'Z')))
  2119.           break;
  2120.       }
  2121.     toktype = parse_number (tokstart, p - tokstart, got_dot|got_e, &yylval);
  2122.         if (toktype == ERROR)
  2123.       {
  2124.         char *err_copy = (char *) alloca (p - tokstart + 1);
  2125.  
  2126.         bcopy (tokstart, err_copy, p - tokstart);
  2127.         err_copy[p - tokstart] = 0;
  2128.         error ("Invalid number \"%s\".", err_copy);
  2129.       }
  2130.     lexptr = p;
  2131.     return toktype;
  2132.       }
  2133.  
  2134.     case '+':
  2135.     case '-':
  2136.     case '*':
  2137.     case '/':
  2138.     case '%':
  2139.     case '|':
  2140.     case '&':
  2141.     case '^':
  2142.     case '~':
  2143.     case '!':
  2144.     case '@':
  2145.     case '<':
  2146.     case '>':
  2147.     case '[':
  2148.     case ']':
  2149.     case '?':
  2150.     case ':':
  2151.     case '=':
  2152.     case '{':
  2153.     case '}':
  2154.     symbol:
  2155.       lexptr++;
  2156.       return c;
  2157.  
  2158.     case '"':
  2159.       for (namelen = 1; (c = tokstart[namelen]) != '"'; namelen++)
  2160.     if (c == '\\')
  2161.       {
  2162.         c = tokstart[++namelen];
  2163.         if (c >= '0' && c <= '9')
  2164.           {
  2165.         c = tokstart[++namelen];
  2166.         if (c >= '0' && c <= '9')
  2167.           c = tokstart[++namelen];
  2168.           }
  2169.       }
  2170.       yylval.sval.ptr = tokstart + 1;
  2171.       yylval.sval.length = namelen - 1;
  2172.       lexptr += namelen + 1;
  2173.       return STRING;
  2174.     }
  2175.  
  2176.   if (!(c == '_' || c == '$'
  2177.     || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
  2178.     /* We must have come across a bad character (e.g. ';').  */
  2179.     error ("Invalid character '%c' in expression.", c);
  2180.  
  2181.   /* It's a name.  See how long it is.  */
  2182.   namelen = 0;
  2183.   for (c = tokstart[namelen];
  2184.        (c == '_' || c == '$' || (c >= '0' && c <= '9')
  2185.     || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
  2186.        c = tokstart[++namelen])
  2187.     ;
  2188.  
  2189.   /* The token "if" terminates the expression and is NOT 
  2190.      removed from the input stream.  */
  2191.   if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f')
  2192.     {
  2193.       return 0;
  2194.     }
  2195.  
  2196.   lexptr += namelen;
  2197.  
  2198.   /* Handle the tokens $digits; also $ (short for $0) and $$ (short for $$1)
  2199.      and $$digits (equivalent to $<-digits> if you could type that).
  2200.      Make token type LAST, and put the number (the digits) in yylval.  */
  2201.  
  2202.   if (*tokstart == '$')
  2203.     {
  2204.       register int negate = 0;
  2205.       c = 1;
  2206.       /* Double dollar means negate the number and add -1 as well.
  2207.      Thus $$ alone means -1.  */
  2208.       if (namelen >= 2 && tokstart[1] == '$')
  2209.     {
  2210.       negate = 1;
  2211.       c = 2;
  2212.     }
  2213.       if (c == namelen)
  2214.     {
  2215.       /* Just dollars (one or two) */
  2216.       yylval.lval = - negate;
  2217.       return LAST;
  2218.     }
  2219.       /* Is the rest of the token digits?  */
  2220.       for (; c < namelen; c++)
  2221.     if (!(tokstart[c] >= '0' && tokstart[c] <= '9'))
  2222.       break;
  2223.       if (c == namelen)
  2224.     {
  2225.       yylval.lval = atoi (tokstart + 1 + negate);
  2226.       if (negate)
  2227.         yylval.lval = - yylval.lval;
  2228.       return LAST;
  2229.     }
  2230.     }
  2231.  
  2232.   /* Handle tokens that refer to machine registers:
  2233.      $ followed by a register name.  */
  2234.  
  2235.   if (*tokstart == '$') {
  2236.     for (c = 0; c < NUM_REGS; c++)
  2237.       if (namelen - 1 == strlen (reg_names[c])
  2238.       && !strncmp (tokstart + 1, reg_names[c], namelen - 1))
  2239.     {
  2240.       yylval.lval = c;
  2241.       return REGNAME;
  2242.     }
  2243.     for (c = 0; c < num_std_regs; c++)
  2244.      if (namelen - 1 == strlen (std_regs[c].name)
  2245.      && !strncmp (tokstart + 1, std_regs[c].name, namelen - 1))
  2246.        {
  2247.      yylval.lval = std_regs[c].regnum;
  2248.      return REGNAME;
  2249.        }
  2250.   }
  2251.   /* Catch specific keywords.  Should be done with a data structure.  */
  2252.   switch (namelen)
  2253.     {
  2254.     case 8:
  2255.       if (!strncmp (tokstart, "unsigned", 8))
  2256.     return UNSIGNED;
  2257.       break;
  2258.     case 6:
  2259.       if (!strncmp (tokstart, "struct", 6))
  2260.     return STRUCT;
  2261.       if (!strncmp (tokstart, "signed", 6))
  2262.     return SIGNED;
  2263.       if (!strncmp (tokstart, "sizeof", 6))      
  2264.     return SIZEOF;
  2265.       break;
  2266.     case 5:
  2267.       if (!strncmp (tokstart, "union", 5))
  2268.     return UNION;
  2269.       if (!strncmp (tokstart, "short", 5))
  2270.     return SHORT;
  2271.       break;
  2272.     case 4:
  2273.       if (!strncmp (tokstart, "enum", 4))
  2274.     return ENUM;
  2275.       if (!strncmp (tokstart, "long", 4))
  2276.     return LONG;
  2277.       if (!strncmp (tokstart, "this", 4))
  2278.     {
  2279.       static const char this_name[] =
  2280.                  { CPLUS_MARKER, 't', 'h', 'i', 's', '\0' };
  2281.  
  2282.       if (lookup_symbol (this_name, expression_context_block,
  2283.                  VAR_NAMESPACE, 0, NULL))
  2284.         return THIS;
  2285.     }
  2286.       break;
  2287.     case 3:
  2288.       if (!strncmp (tokstart, "int", 3))
  2289.     return INT_KEYWORD;
  2290.       break;
  2291.     default:
  2292.       break;
  2293.     }
  2294.  
  2295.   yylval.sval.ptr = tokstart;
  2296.   yylval.sval.length = namelen;
  2297.  
  2298.   /* Any other names starting in $ are debugger internal variables.  */
  2299.  
  2300.   if (*tokstart == '$')
  2301.     {
  2302.       yylval.ivar =  lookup_internalvar (copy_name (yylval.sval) + 1);
  2303.       return VARIABLE;
  2304.     }
  2305.  
  2306.   /* Use token-type BLOCKNAME for symbols that happen to be defined as
  2307.      functions or symtabs.  If this is not so, then ...
  2308.      Use token-type TYPENAME for symbols that happen to be defined
  2309.      currently as names of types; NAME for other symbols.
  2310.      The caller is not constrained to care about the distinction.  */
  2311.   {
  2312.     char *tmp = copy_name (yylval.sval);
  2313.     struct symbol *sym;
  2314.     int is_a_field_of_this = 0;
  2315.     int hextype;
  2316.  
  2317.     sym = lookup_symbol (tmp, expression_context_block,
  2318.              VAR_NAMESPACE, &is_a_field_of_this, NULL);
  2319.     if ((sym && SYMBOL_CLASS (sym) == LOC_BLOCK) ||
  2320.         lookup_partial_symtab (tmp))
  2321.       {
  2322.     yylval.ssym.sym = sym;
  2323.     yylval.ssym.is_a_field_of_this = is_a_field_of_this;
  2324.     return BLOCKNAME;
  2325.       }
  2326.     if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
  2327.         {
  2328.       yylval.tsym.type = SYMBOL_TYPE (sym);
  2329.       return TYPENAME;
  2330.         }
  2331.     if ((yylval.tsym.type = lookup_primitive_typename (tmp)) != 0)
  2332.     return TYPENAME;
  2333.  
  2334.     /* Input names that aren't symbols but ARE valid hex numbers,
  2335.        when the input radix permits them, can be names or numbers
  2336.        depending on the parse.  Note we support radixes > 16 here.  */
  2337.     if (!sym && 
  2338.         ((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10) ||
  2339.          (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
  2340.       {
  2341.      YYSTYPE newlval;    /* Its value is ignored.  */
  2342.     hextype = parse_number (tokstart, namelen, 0, &newlval);
  2343.     if (hextype == INT)
  2344.       {
  2345.         yylval.ssym.sym = sym;
  2346.         yylval.ssym.is_a_field_of_this = is_a_field_of_this;
  2347.         return NAME_OR_INT;
  2348.       }
  2349.     if (hextype == UINT)
  2350.       {
  2351.         yylval.ssym.sym = sym;
  2352.         yylval.ssym.is_a_field_of_this = is_a_field_of_this;
  2353.         return NAME_OR_UINT;
  2354.       }
  2355.       }
  2356.  
  2357.     /* Any other kind of symbol */
  2358.     yylval.ssym.sym = sym;
  2359.     yylval.ssym.is_a_field_of_this = is_a_field_of_this;
  2360.     return NAME;
  2361.   }
  2362. }
  2363.  
  2364. void
  2365. yyerror (msg)
  2366.      char *msg;
  2367. {
  2368.   error ("Invalid syntax in expression.");
  2369. }
  2370.  
  2371. /* Table mapping opcodes into strings for printing operators
  2372.    and precedences of the operators.  */
  2373.  
  2374. const static struct op_print c_op_print_tab[] =
  2375.   {
  2376.     {",",  BINOP_COMMA, PREC_COMMA, 0},
  2377.     {"=",  BINOP_ASSIGN, PREC_ASSIGN, 1},
  2378.     {"||", BINOP_OR, PREC_OR, 0},
  2379.     {"&&", BINOP_AND, PREC_AND, 0},
  2380.     {"|",  BINOP_LOGIOR, PREC_LOGIOR, 0},
  2381.     {"&",  BINOP_LOGAND, PREC_LOGAND, 0},
  2382.     {"^",  BINOP_LOGXOR, PREC_LOGXOR, 0},
  2383.     {"==", BINOP_EQUAL, PREC_EQUAL, 0},
  2384.     {"!=", BINOP_NOTEQUAL, PREC_EQUAL, 0},
  2385.     {"<=", BINOP_LEQ, PREC_ORDER, 0},
  2386.     {">=", BINOP_GEQ, PREC_ORDER, 0},
  2387.     {">",  BINOP_GTR, PREC_ORDER, 0},
  2388.     {"<",  BINOP_LESS, PREC_ORDER, 0},
  2389.     {">>", BINOP_RSH, PREC_SHIFT, 0},
  2390.     {"<<", BINOP_LSH, PREC_SHIFT, 0},
  2391.     {"+",  BINOP_ADD, PREC_ADD, 0},
  2392.     {"-",  BINOP_SUB, PREC_ADD, 0},
  2393.     {"*",  BINOP_MUL, PREC_MUL, 0},
  2394.     {"/",  BINOP_DIV, PREC_MUL, 0},
  2395.     {"%",  BINOP_REM, PREC_MUL, 0},
  2396.     {"@",  BINOP_REPEAT, PREC_REPEAT, 0},
  2397.     {"-",  UNOP_NEG, PREC_PREFIX, 0},
  2398.     {"!",  UNOP_ZEROP, PREC_PREFIX, 0},
  2399.     {"~",  UNOP_LOGNOT, PREC_PREFIX, 0},
  2400.     {"*",  UNOP_IND, PREC_PREFIX, 0},
  2401.     {"&",  UNOP_ADDR, PREC_PREFIX, 0},
  2402.     {"sizeof ", UNOP_SIZEOF, PREC_PREFIX, 0},
  2403.     {"++", UNOP_PREINCREMENT, PREC_PREFIX, 0},
  2404.     {"--", UNOP_PREDECREMENT, PREC_PREFIX, 0},
  2405.     /* C++  */
  2406.     {"::", BINOP_SCOPE, PREC_PREFIX, 0},
  2407. };
  2408.  
  2409. /* These variables point to the objects
  2410.    representing the predefined C data types.  */
  2411.  
  2412. struct type *builtin_type_void;
  2413. struct type *builtin_type_char;
  2414. struct type *builtin_type_short;
  2415. struct type *builtin_type_int;
  2416. struct type *builtin_type_long;
  2417. struct type *builtin_type_long_long;
  2418. struct type *builtin_type_unsigned_char;
  2419. struct type *builtin_type_unsigned_short;
  2420. struct type *builtin_type_unsigned_int;
  2421. struct type *builtin_type_unsigned_long;
  2422. struct type *builtin_type_unsigned_long_long;
  2423. struct type *builtin_type_float;
  2424. struct type *builtin_type_double;
  2425.  
  2426. struct type ** const (c_builtin_types[]) = 
  2427. {
  2428.   &builtin_type_int,
  2429.   &builtin_type_long,
  2430.   &builtin_type_short,
  2431.   &builtin_type_char,
  2432.   &builtin_type_float,
  2433.   &builtin_type_double,
  2434.   &builtin_type_void,
  2435.   &builtin_type_long_long,
  2436.   &builtin_type_unsigned_char,
  2437.   &builtin_type_unsigned_short,
  2438.   &builtin_type_unsigned_int,
  2439.   &builtin_type_unsigned_long,
  2440.   &builtin_type_unsigned_long_long,
  2441.   0
  2442. };
  2443.  
  2444. /* FIXME:  Eventually do a separate defintion for C++.  */
  2445.  
  2446. const struct language_defn c_language_defn = {
  2447.   "c",                /* Language name */
  2448.   language_c,
  2449.   c_builtin_types,
  2450.   range_check_off,
  2451.   type_check_off,
  2452.   c_parse,
  2453.   c_error,
  2454.   &BUILTIN_TYPE_LONGEST,     /* longest signed   integral type */
  2455.   &BUILTIN_TYPE_UNSIGNED_LONGEST,/* longest unsigned integral type */
  2456.   &builtin_type_double,        /* longest floating point type */
  2457.   "0x%x", "0x%", "x",        /* Hex   format, prefix, suffix */
  2458.   "0%o",  "0%",  "o",        /* Octal format, prefix, suffix */
  2459.   c_op_print_tab,        /* expression operators for printing */
  2460.   LANG_MAGIC
  2461. };
  2462.  
  2463. void
  2464. _initialize_c_exp ()
  2465. {
  2466.   /* FIXME:  The code below assumes that the sizes of the basic data
  2467.      types are the same on the host and target machines!!!  */
  2468.  
  2469.   builtin_type_void = init_type (TYPE_CODE_VOID, 1, 0, "void");
  2470.  
  2471.   builtin_type_float = init_type (TYPE_CODE_FLT, sizeof (float), 0, "float");
  2472.   builtin_type_double = init_type (TYPE_CODE_FLT, sizeof (double), 0, "double");
  2473.  
  2474.   builtin_type_char = init_type (TYPE_CODE_INT, sizeof (char), 0, "char");
  2475.   builtin_type_short = init_type (TYPE_CODE_INT, sizeof (short), 0, "short");
  2476.   builtin_type_long = init_type (TYPE_CODE_INT, sizeof (long), 0, "long");
  2477.   builtin_type_int = init_type (TYPE_CODE_INT, sizeof (int), 0, "int");
  2478.  
  2479.   builtin_type_unsigned_char = init_type (TYPE_CODE_INT, sizeof (char), 1, "unsigned char");
  2480.   builtin_type_unsigned_short = init_type (TYPE_CODE_INT, sizeof (short), 1, "unsigned short");
  2481.   builtin_type_unsigned_long = init_type (TYPE_CODE_INT, sizeof (long), 1, "unsigned long");
  2482.   builtin_type_unsigned_int = init_type (TYPE_CODE_INT, sizeof (int), 1, "unsigned int");
  2483.  
  2484.   builtin_type_long_long =
  2485.     init_type (TYPE_CODE_INT, TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
  2486.            0, "long long");
  2487.   builtin_type_unsigned_long_long = 
  2488.     init_type (TYPE_CODE_INT, TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
  2489.            1, "unsigned long long");
  2490.  
  2491.   add_language (&c_language_defn);
  2492.   set_language (language_c);        /* Make C the default language */
  2493. }
  2494.